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 MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price = SUM(price);\nCalculate the total price of items for menu with ID 12882.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.price) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id WHERE T1.menu_id = 12882",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(T2.price) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id WHERE T1.menu_id = 12882",
"index": 2700,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price = SUM(price);\nCalculate the total price of items for menu with ID 12882.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'list', 'Consomme printaniere royal', 'Chicken gumbo']\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest price refers to MAX(highest_price);\nList the top five dishes, by descending order, in terms of highest price.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Dish ORDER BY highest_price DESC LIMIT 5",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT name FROM Dish ORDER BY highest_price DESC LIMIT 5",
"index": 2701,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'list', 'Consomme printaniere royal', 'Chicken gumbo']\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest price refers to MAX(highest_price);\nList the top five dishes, by descending order, in terms of highest price.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst appearance in 1855 refers to first_appeared = 1855; last appearance in 1900 refers to last_appeared = 1900;\nWhat dishes made their first and last appearances in 1855 and 1900, respectively?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Dish WHERE first_appeared = 1855 AND last_appeared = 1900",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT name FROM Dish WHERE first_appeared = 1855 AND last_appeared = 1900",
"index": 2702,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst appearance in 1855 refers to first_appeared = 1855; last appearance in 1900 refers to last_appeared = 1900;\nWhat dishes made their first and last appearances in 1855 and 1900, respectively?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest dish count refers to MAX(dish_count);\nWrite down the top ten menus with the highest dish count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Menu GROUP BY name ORDER BY dish_count DESC LIMIT 10",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT name FROM Menu GROUP BY name ORDER BY dish_count DESC LIMIT 10",
"index": 2703,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest dish count refers to MAX(dish_count);\nWrite down the top ten menus with the highest dish count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappear in the right upper corner of the menu page refers to xpos > 0.75 and ypos < 0.25;\nHow many dishes appear in the right upper corner of the menu page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T1.dish_id = T2.id WHERE T1.xpos > 0.75 AND T1.ypos < 0.25",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T1.dish_id = T2.id WHERE T1.xpos > 0.75 AND T1.ypos < 0.25",
"index": 2704,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappear in the right upper corner of the menu page refers to xpos > 0.75 and ypos < 0.25;\nHow many dishes appear in the right upper corner of the menu page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nClear Green Turtle is a name of dish; how long a dish appeared on the menu = SUBTRACT(last_appeared, first_appeared); latest update refers to latest updated_at;\nHow long has the \"Clear Green Turtle\" dish appeared on the menu, and tell me when its latest update was?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.last_appeared - T1.first_appeared, T2.updated_at FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Clear green turtle'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.last_appeared - T1.first_appeared, T2.updated_at FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Clear green turtle'",
"index": 2705,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Clear green turtle ', 'Clear Green Turtle ', 'Clear Green Turtle', 'Green Turtle ', 'Green Turtle', 'Green turtle']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nClear Green Turtle is a name of dish; how long a dish appeared on the menu = SUBTRACT(last_appeared, first_appeared); latest update refers to latest updated_at;\nHow long has the \"Clear Green Turtle\" dish appeared on the menu, and tell me when its latest update was?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappeared on the menu in less than 5 years = SUBTRACT(last_appeared, first_appeared) < 5;\nHow many dishes have appeared on the menu in less than 5 years?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.last_appeared - T1.first_appeared < 5",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.last_appeared - T1.first_appeared < 5",
"index": 2706,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappeared on the menu in less than 5 years = SUBTRACT(last_appeared, first_appeared) < 5;\nHow many dishes have appeared on the menu in less than 5 years?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-04-15 23:09:51 UTC', '2011-03-31 20:24:46 UTC', '2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-15 23:09:51 UTC', '2011-03-31 20:24:46 UTC', '2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncreated between 2011-03-31 at 20:24:46 UTC and 2011-04-15 at 23:09:51 UTC refers to created_at between '2011-03-31 20:24:46 UTC' AND '2011-04-15 23:09:51 UTC';\nAmong the dishes, how many of them were created between 2011-03-31 at 20:24:46 UTC and 2011-04-15 at 23:09:51 UTC.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T2.created_at BETWEEN '2011-03-31 20:24:46 UTC' AND '2011-04-15 23:09:51 UTC' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.created_at BETWEEN '2011-03-31 20:24:46 UTC' AND '2011-04-15 23:09:51 UTC' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id",
"index": 2707,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-04-15 23:09:51 UTC', '2011-03-31 20:24:46 UTC', '2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-15 23:09:51 UTC', '2011-03-31 20:24:46 UTC', '2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncreated between 2011-03-31 at 20:24:46 UTC and 2011-04-15 at 23:09:51 UTC refers to created_at between '2011-03-31 20:24:46 UTC' AND '2011-04-15 23:09:51 UTC';\nAmong the dishes, how many of them were created between 2011-03-31 at 20:24:46 UTC and 2011-04-15 at 23:09:51 UTC.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n keywords text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'MM', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull width less than 2000 mm refers to full_width < 2000;\nUnder what events was the menu page's full width less than 2000 mm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.event FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T2.full_width = 2000",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.event FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T2.full_width = 2000",
"index": 2708,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n keywords text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'MM', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull width less than 2000 mm refers to full_width < 2000;\nUnder what events was the menu page's full width less than 2000 mm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost 180,000 refers to price = 180000;\nName the dishes that cost 180,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 T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.price = 180000",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.price = 180000",
"index": 2709,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost 180,000 refers to price = 180000;\nName the dishes that cost 180,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 MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['1 image', 'WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n location_type text,\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Baked Stuffed Mullet & Sauce Pomard', 'Stuffed', 'stuffed', 'Pomard', 'Mullet', 'Sauce']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimage area = MULTIPLY(full_height, full_width);\nCalculate the image area of the page menu for the dish named \"Baked Stuffed Mullet & Sauce Pomard\". Please include the page number and image ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.full_height * T1.full_width, T1.page_number, T1.image_id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Baked Stuffed Mullet & Sauce Pomard'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.full_height * T1.full_width, T1.page_number, T1.image_id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Baked Stuffed Mullet & Sauce Pomard'",
"index": 2710,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['1 image', 'WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n location_type text,\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Baked Stuffed Mullet & Sauce Pomard', 'Stuffed', 'stuffed', 'Pomard', 'Mullet', 'Sauce']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimage area = MULTIPLY(full_height, full_width);\nCalculate the image area of the page menu for the dish named \"Baked Stuffed Mullet & Sauce Pomard\". Please include the page number and image 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 MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['Krogs Fiskerestaurant', 'The Restaurant', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n place text, -- example: ['Krogs Fiskerestaurant', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Krogs Fiske Restaurant refers to sponsor = 'Krogs Fiskerestaurant'; created in April 2015 refers to date like '2015-04%';\nHow many menus sponsored by Krogs Fiske Restaurant were created in April 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Menu WHERE date LIKE '2015-04%' AND sponsor = 'Krogs Fiskerestaurant'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Menu WHERE date LIKE '2015-04%' AND sponsor = 'Krogs Fiskerestaurant'",
"index": 2711,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['Krogs Fiskerestaurant', 'The Restaurant', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n place text, -- example: ['Krogs Fiskerestaurant', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Krogs Fiske Restaurant refers to sponsor = 'Krogs Fiskerestaurant'; created in April 2015 refers to date like '2015-04%';\nHow many menus sponsored by Krogs Fiske Restaurant were created in April 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n location_type text,\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Puree of split peas aux croutons', 'Puree of Split Peas aux Crouton', 'Split peas aux croutons', 'Puree of Split Peas ', 'Puree of split peas ', 'Puree of split peas']\n menus_appeared integer, -- example: [8, 111]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npuree of split peas aux croutons is a name of dish;\nHow many menus include puree of split peas aux croutons?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.name = 'Puree of split peas aux croutons' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.name = 'Puree of split peas aux croutons' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id",
"index": 2712,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n location_type text,\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Puree of split peas aux croutons', 'Puree of Split Peas aux Crouton', 'Split peas aux croutons', 'Puree of Split Peas ', 'Puree of split peas ', 'Puree of split peas']\n menus_appeared integer, -- example: [8, 111]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npuree of split peas aux croutons is a name of dish;\nHow many menus include puree of split peas aux croutons?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['PACIFIC MAIL STEAMSHIP COMPANY', 'MAIL STEAMSHIP COMPANY', 'PACIFIC MAIL STEAMSHIP CO.', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n place text, -- example: ['STEAMSHIP', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Pacific Mail Steamship Company', 'Mail Steamship Company', 'Pacific Mail Steamship Co.', 'Company C', 'Hotel Eastman', 'Republican House']\n location_type text,\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Pacific Mail Steamship Company refers to sponsor = 'PACIFIC MAIL STEAMSHIP COMPANY'; no more than 2 pages refers to COUNT(page_number) < = 2;\nAmong the menus sponsored by Pacific Mail Steamship Company, how many menus have no more than 2 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.sponsor = 'PACIFIC MAIL STEAMSHIP COMPANY' GROUP BY T2.menu_id HAVING COUNT(T2.page_number) <= 2",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.sponsor = 'PACIFIC MAIL STEAMSHIP COMPANY' GROUP BY T2.menu_id HAVING COUNT(T2.page_number) <= 2",
"index": 2713,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['PACIFIC MAIL STEAMSHIP COMPANY', 'MAIL STEAMSHIP COMPANY', 'PACIFIC MAIL STEAMSHIP CO.', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n place text, -- example: ['STEAMSHIP', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Pacific Mail Steamship Company', 'Mail Steamship Company', 'Pacific Mail Steamship Co.', 'Company C', 'Hotel Eastman', 'Republican House']\n location_type text,\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Pacific Mail Steamship Company refers to sponsor = 'PACIFIC MAIL STEAMSHIP COMPANY'; no more than 2 pages refers to COUNT(page_number) < = 2;\nAmong the menus sponsored by Pacific Mail Steamship Company, how many menus have no more than 2 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmilk is a name of dish; highest price refers to MAX(price);\nAmong the menus that include milk, what is the menu page id of the menu that has the highest price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.menu_page_id FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T2.name = 'Milk' ORDER BY T1.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.menu_page_id FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T2.name = 'Milk' ORDER BY T1.price DESC LIMIT 1",
"index": 2714,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmilk is a name of dish; highest price refers to MAX(price);\nAmong the menus that include milk, what is the menu page id of the menu that has the highest price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['OCCIDENTAL & ORIENTAL STEAMSHIP COMPANY', 'OCCIDENTAL & ORIENTAL', 'OCCIDENTAL AND ORIENTAL STEAMSHIP CO.', 'OCCIDENTAL & ORIENTAL STEAMSHIP CO.', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['STEAMSHIP', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `language` text,\n location_type text,\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Occidental and Oriental Steamship Company refers to sponsor = 'OCCIDENTAL & ORIENTAL STEAMSHIP COMPANY'; highest number of pages refers to MAX(COUNT(page_number));\nWhat is the menu id of the menu sponsored by Occidental and Oriental Steamship Company with the highest number of pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.menu_id FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.sponsor = 'OCCIDENTAL & ORIENTAL STEAMSHIP COMPANY' GROUP BY T2.menu_id ORDER BY COUNT(T2.page_number) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.menu_id FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.sponsor = 'OCCIDENTAL & ORIENTAL STEAMSHIP COMPANY' GROUP BY T2.menu_id ORDER BY COUNT(T2.page_number) DESC LIMIT 1",
"index": 2715,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n menus_appeared integer, -- example: [8, 111]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n sponsor text, -- example: ['OCCIDENTAL & ORIENTAL STEAMSHIP COMPANY', 'OCCIDENTAL & ORIENTAL', 'OCCIDENTAL AND ORIENTAL STEAMSHIP CO.', 'OCCIDENTAL & ORIENTAL STEAMSHIP CO.', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['STEAMSHIP', 'HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n `language` text,\n location_type text,\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by Occidental and Oriental Steamship Company refers to sponsor = 'OCCIDENTAL & ORIENTAL STEAMSHIP COMPANY'; highest number of pages refers to MAX(COUNT(page_number));\nWhat is the menu id of the menu sponsored by Occidental and Oriental Steamship Company with the highest number of pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Breaded veal cutlet with peas', 'Veal cutlet with peas', 'Breaded Veal', 'veal cutlet', 'Veal cutlet', 'with peas']\n description text,\n times_appeared integer, -- example: [8, 117]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npositions = xpos, ypos; breaded veal cutlet with peas is a name of dish;\nList the positions of the dish \"breaded veal cutlet with peas\" on every menu where it appeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.xpos, T2.ypos FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'breaded veal cutlet with peas'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.xpos, T2.ypos FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'breaded veal cutlet with peas'",
"index": 2716,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Breaded veal cutlet with peas', 'Veal cutlet with peas', 'Breaded Veal', 'veal cutlet', 'Veal cutlet', 'with peas']\n description text,\n times_appeared integer, -- example: [8, 117]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npositions = xpos, ypos; breaded veal cutlet with peas is a name of dish;\nList the positions of the dish \"breaded veal cutlet with peas\" on every menu where it appeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['THE SOCIETY OF THE CUMBERLAND', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['19NTH REUNION', 'REUNION', 'BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['GRAND PACIFIC HOTEL, CHICAGO, IL', 'GRAND PACIFIC HOTEL,', 'GRAND PACIFIC HOTEL', 'CHICAGO, ILL', '(CHICAGO, ILL)', 'HOT SPRINGS, AR']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n location text, -- example: ['The Society Of The Cumberland', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Cumberland', 'Society', 'DISHES', 'menu', 'MENU', 'dish']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by The Society of Cumberland refers to sponsor = 'THE SOCIETY OF THE CUMBERLAND'; created for the 19th reunion refers to event = '19NTH REUNION'; Grand Pacific Hotel in Chicago, Illinois refers to place = 'GRAND PACIFIC HOTEL, CHICAGO, ILL';\nWhat are the names of the dishes in the menu sponsored by The Society of Cumberland that was created for the 19th reunion at Grand Pacific Hotel in Chicago, Illinois?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id INNER JOIN MenuItem AS T3 ON T2.id = T3.menu_page_id INNER JOIN Dish AS T4 ON T3.dish_id = T4.id WHERE T1.sponsor = 'THE SOCIETY OF THE CUMBERLAND' AND T1.event = '19NTH REUNION' AND T1.place = 'GRAND PACIFIC HOTEL,CHICAGO,ILL'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T4.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id INNER JOIN MenuItem AS T3 ON T2.id = T3.menu_page_id INNER JOIN Dish AS T4 ON T3.dish_id = T4.id WHERE T1.sponsor = 'THE SOCIETY OF THE CUMBERLAND' AND T1.event = '19NTH REUNION' AND T1.place = 'GRAND PACIFIC HOTEL,CHICAGO,ILL'",
"index": 2717,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['THE SOCIETY OF THE CUMBERLAND', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['19NTH REUNION', 'REUNION', 'BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['GRAND PACIFIC HOTEL, CHICAGO, IL', 'GRAND PACIFIC HOTEL,', 'GRAND PACIFIC HOTEL', 'CHICAGO, ILL', '(CHICAGO, ILL)', 'HOT SPRINGS, AR']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n location text, -- example: ['The Society Of The Cumberland', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Cumberland', 'Society', 'DISHES', 'menu', 'MENU', 'dish']\n description text,\n menus_appeared integer, -- example: [8, 111]\n first_appeared integer, -- example: [1897, 1895]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsponsored by The Society of Cumberland refers to sponsor = 'THE SOCIETY OF THE CUMBERLAND'; created for the 19th reunion refers to event = '19NTH REUNION'; Grand Pacific Hotel in Chicago, Illinois refers to place = 'GRAND PACIFIC HOTEL, CHICAGO, ILL';\nWhat are the names of the dishes in the menu sponsored by The Society of Cumberland that was created for the 19th reunion at Grand Pacific Hotel in Chicago, Illinois?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Baked Apples', 'Baked apples', 'BAKED APPLE', 'Baked apple', 'Apples', 'Apple']\n description text,\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbaked apples with cream is a name of dish; highest price refers to MAX(price);\nAmong the menus that include baked apples with cream, who is the sponsor of the menu with the highest price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.sponsor FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id INNER JOIN Menu AS T4 ON T4.id = T1.menu_id WHERE T3.name = 'Baked apples with cream' AND T3.id = 107 ORDER BY T2.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T4.sponsor FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id INNER JOIN Menu AS T4 ON T4.id = T1.menu_id WHERE T3.name = 'Baked apples with cream' AND T3.id = 107 ORDER BY T2.price DESC LIMIT 1",
"index": 2718,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Baked Apples', 'Baked apples', 'BAKED APPLE', 'Baked apple', 'Apples', 'Apple']\n description text,\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbaked apples with cream is a name of dish; highest price refers to MAX(price);\nAmong the menus that include baked apples with cream, who is the sponsor of the menu with the highest price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['De Luxe', 'Souper', 'DISHES', 'menu', 'MENU', 'dish']\n description text,\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Souper de Luxe', 'The Modern', 'Restaurant']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of dishes per menu = DIVIDE(COUNT(dish_id), COUNT(menu_page_id)); Souper de Luxe is a name of menu; dish that appeared the most in all of its menus refers to MAX(COUNT(dish_id));\nWhat is the average number of dishes per menu in the Souper de Luxe menus? Identify what is the name of the dish that appeared the most in all of its menus.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*), T1.dish_id FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.name = 'Souper de Luxe' GROUP BY T3.id ORDER BY COUNT(T1.dish_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*), T1.dish_id FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.name = 'Souper de Luxe' GROUP BY T3.id ORDER BY COUNT(T1.dish_id) DESC LIMIT 1",
"index": 2719,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['De Luxe', 'Souper', 'DISHES', 'menu', 'MENU', 'dish']\n description text,\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Souper de Luxe', 'The Modern', 'Restaurant']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of dishes per menu = DIVIDE(COUNT(dish_id), COUNT(menu_page_id)); Souper de Luxe is a name of menu; dish that appeared the most in all of its menus refers to MAX(COUNT(dish_id));\nWhat is the average number of dishes per menu in the Souper de Luxe menus? Identify what is the name of the dish that appeared the most in all of its menus.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost number of dishes refers to MAX(COUNT(dish_count));\nWhat is the ID of the menu with the most number of dishes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT id FROM Menu ORDER BY dish_count DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT id FROM Menu ORDER BY dish_count DESC LIMIT 1",
"index": 2720,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost number of dishes refers to MAX(COUNT(dish_count));\nWhat is the ID of the menu with the most number of dishes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Zentral Theater Terrace', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n times_appeared integer, -- example: [8, 117]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nZentral Theater Terrace is a name of menu;\nHow many dishes are there on the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Menu WHERE name = 'Zentral Theater Terrace'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Menu WHERE name = 'Zentral Theater Terrace'",
"index": 2721,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Zentral Theater Terrace', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'dish', 'menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n times_appeared integer, -- example: [8, 117]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nZentral Theater Terrace is a name of menu;\nHow many dishes are there on the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency_symbol text, -- example: ['$', 'c']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndid not support taking out or booking in advance refers to call_number is null; created before 1950 refers to strftime('%Y', date) < '1950';\nAmong the menus that did not support taking out or booking in advance, how many of them were created before 1950?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Menu WHERE call_number IS NULL AND strftime('%Y', date) < '1950'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Menu WHERE call_number IS NULL AND strftime('%Y', date) < '1950'",
"index": 2722,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n call_number text, -- example: ['1900-2822', '1900-2825']\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n currency_symbol text, -- example: ['$', 'c']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndid not support taking out or booking in advance refers to call_number is null; created before 1950 refers to strftime('%Y', date) < '1950';\nAmong the menus that did not support taking out or booking in advance, how many of them were created before 1950?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage 1 refers to page_number = 1; Zentral Theater Terrace is a name of menu;\nWhat is the image ID of page 1 of the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.image_id FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.image_id FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1",
"index": 2723,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n currency text, -- example: ['Dollars', 'Cents']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage 1 refers to page_number = 1; Zentral Theater Terrace is a name of menu;\nWhat is the image ID of page 1 of the menu \"Zentral Theater Terrace\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n `language` text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n times_appeared integer, -- example: [8, 117]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nTo which menu does the menu page image ID5189412 belong? Please give its 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 T1.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T2.image_id = 5189412",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T2.image_id = 5189412",
"index": 2724,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n `language` text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n times_appeared integer, -- example: [8, 117]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nTo which menu does the menu page image ID5189412 belong? Please give its 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 Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Ritz Carlton', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Ritz Carlton', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Ritz Carlton', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRitz Carlton is a name of menu; biggest height refers to MAX(full_height);\nWhich menu page of \"Ritz Carlton\" has the biggest height?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.page_number FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.name = 'Ritz Carlton' ORDER BY T1.full_height DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.page_number FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.name = 'Ritz Carlton' ORDER BY T1.full_height DESC LIMIT 1",
"index": 2725,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Ritz Carlton', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Ritz Carlton', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `language` text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Ritz Carlton', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRitz Carlton is a name of menu; biggest height refers to MAX(full_height);\nWhich menu page of \"Ritz Carlton\" has the biggest height?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Chicken Gumbo ', 'CHICKEN GUMBO', 'chicken gumbo', 'Chicken Gumbo', 'Chicken gumbo', 'Gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChicken gumbo is a name of dish;\nPlease list the page numbers of all the menu pages on which the dish \"Chicken gumbo\" had appeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.page_number FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo'",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.page_number FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo'",
"index": 2726,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n physical_description text, -- example: ['CARD; 4.75X7.5;', 'CARD; ILLUS; COL; 7.0X9.0;']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n currency_symbol text, -- example: ['$', 'c']\n page_count integer, -- example: [2, 4]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Chicken Gumbo ', 'CHICKEN GUMBO', 'chicken gumbo', 'Chicken Gumbo', 'Chicken gumbo', 'Gumbo']\n description text,\n first_appeared integer, -- example: [1897, 1895]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChicken gumbo is a name of dish;\nPlease list the page numbers of all the menu pages on which the dish \"Chicken gumbo\" had appeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Chicken Gumbo ', 'CHICKEN GUMBO', 'chicken gumbo', 'Chicken Gumbo', 'Chicken gumbo', 'Gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChicken gumbo is a name of dish; biggest width refers to MAX(full_width);\nAmong the menu pages on which the dish \"Chicken gumbo\" had appeared, what is the menu ID of the one with the biggest width?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo' ORDER BY T1.full_width DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T1.id FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo' ORDER BY T1.full_width DESC LIMIT 1",
"index": 2727,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Chicken Gumbo ', 'CHICKEN GUMBO', 'chicken gumbo', 'Chicken Gumbo', 'Chicken gumbo', 'Gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n full_width integer, -- example: [5428, 7230]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n notes text, -- example: ['WEDGEWOOD BLUE CARD; WHITE EMBOSSED GREE', 'MENU IN GERMAN AND ENGLISH; ILLUS, STEAM']\n keywords text,\n location text, -- example: ['Hotel Eastman', 'Republican House']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChicken gumbo is a name of dish; biggest width refers to MAX(full_width);\nAmong the menu pages on which the dish \"Chicken gumbo\" had appeared, what is the menu ID of the one with the biggest width?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Paysanne soup', 'Paysanne Soup', 'Paysanne', 'menu', 'MENU', 'dish']\n description text,\n times_appeared integer, -- example: [8, 117]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['NULL', 'COMMERCIAL', 'SOC;']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPaysanne Soup is a name of dish; stable price refers to highest_price is null;\nAmong the menu pages on which the dish \"Paysanne Soup\" had appeared, how many of them had a stable price for the dish?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.name = 'Paysanne Soup' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.highest_price IS NULL",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.name = 'Paysanne Soup' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.highest_price IS NULL",
"index": 2728,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['Paysanne soup', 'Paysanne Soup', 'Paysanne', 'menu', 'MENU', 'dish']\n description text,\n times_appeared integer, -- example: [8, 117]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n image_id real, -- example: [1603595.0, 1603596.0]\n uuid text, -- example: ['510d47e4-2955-a3d9-e040-e00a18064a99', '510d47e4-2956-a3d9-e040-e00a18064a99']\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['NULL', 'COMMERCIAL', 'SOC;']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPaysanne Soup is a name of dish; stable price refers to highest_price is null;\nAmong the menu pages on which the dish \"Paysanne Soup\" had appeared, how many of them had a stable price for the dish?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Zentral Theater Terrace', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Zentral Theater Terrace', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow much space = MULTIPLY(full_height, full_width); Zentral Theater Terrace is a name of menu;\nHow much space does page 1 of the menu \"Zentral Theater Terrace\" cover?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.full_height * T2.full_width FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT T2.full_height * T2.full_width FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id WHERE T1.name = 'Zentral Theater Terrace' AND T2.page_number = 1",
"index": 2729,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['menu', 'MENU', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n menus_appeared integer, -- example: [8, 111]\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n highest_price real, -- example: [0.4, 0.8]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['Zentral Theater Terrace', 'The Modern', 'Restaurant']\n sponsor text, -- example: ['Zentral Theater Terrace', 'HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n place text, -- example: ['HOT SPRINGS, AR', 'MILWAUKEE, [WI];']\n occasion text, -- example: ['EASTER;', 'ANNIVERSARY;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n keywords text,\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Zentral Theater Terrace', 'Hotel Eastman', 'Republican House']\n location_type text,\n currency text, -- example: ['Dollars', 'Cents']\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n page_count integer, -- example: [2, 4]\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_height integer, -- example: [7230, 5428]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow much space = MULTIPLY(full_height, full_width); Zentral Theater Terrace is a name of menu;\nHow much space does page 1 of the menu \"Zentral Theater Terrace\" cover?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of dishes per menu = DIVIDE(COUNT(dish_id), COUNT(page_count));\nWhat is the average number of dishes per menu page of menu ID12882?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(dish_id) AS REAL) / COUNT(T3.page_count) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.menu_id = 12882",
"style": "rule"
} | {
"db_id": "menu.sqlite",
"gt_sql": "SELECT CAST(COUNT(dish_id) AS REAL) / COUNT(T3.page_count) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.menu_id = 12882",
"index": 2730,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Menu (\n id integer, -- example: [12463, 12464]\n name text, -- example: ['The Modern', 'Restaurant']\n sponsor text, -- example: ['HOTEL EASTMAN', 'REPUBLICAN HOUSE']\n event text, -- example: ['BREAKFAST', '[DINNER]']\n venue text, -- example: ['COMMERCIAL', 'SOC;']\n call_number text, -- example: ['1900-2822', '1900-2825']\n `date` date, -- example: ['1900-04-15', '1900-04-16']\n location text, -- example: ['Hotel Eastman', 'Republican House']\n location_type text,\n currency_symbol text, -- example: ['$', 'c']\n status text, -- example: ['complete']\n dish_count integer, -- example: [67, 34]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE Dish (\n id integer, -- example: [1, 2]\n name text, -- example: ['DISHES', 'menu', 'MENU', 'dish', 'Consomme printaniere royal', 'Chicken gumbo']\n description text,\n times_appeared integer, -- example: [8, 117]\n first_appeared integer, -- example: [1897, 1895]\n last_appeared integer, -- example: [1927, 1960]\n lowest_price real, -- example: [0.2, 0.1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE MenuItem (\n id integer, -- example: [1, 2]\n menu_page_id integer, -- example: [1389, 3079]\n price real, -- example: [0.4, 0.6]\n high_price real, -- example: [1.0, 3.0]\n dish_id integer, -- example: [1, 2]\n created_at text, -- example: ['2011-03-28 15:00:44 UTC', '2011-03-28 15:01:13 UTC']\n updated_at text, -- example: ['2011-04-19 04:33:15 UTC', '2011-04-19 15:00:54 UTC']\n xpos real, -- x position, example: [0.111429, 0.438571]\n ypos real, -- y position, example: [0.254735, 0.261922]\n PRIMARY KEY (id),\n CONSTRAINT fk_menuitem_menu_page_id FOREIGN KEY (menu_page_id) REFERENCES MenuPage (id),\n CONSTRAINT fk_menuitem_dish_id FOREIGN KEY (dish_id) REFERENCES Dish (id)\n);\n\nCREATE TABLE MenuPage (\n id integer, -- example: [119, 120]\n menu_id integer, -- example: [12460, 12461]\n page_number integer, -- example: [1, 2]\n image_id real, -- example: [1603595.0, 1603596.0]\n full_width integer, -- example: [5428, 7230]\n PRIMARY KEY (id),\n CONSTRAINT fk_menupage_menu_id FOREIGN KEY (menu_id) REFERENCES Menu (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of dishes per menu = DIVIDE(COUNT(dish_id), COUNT(page_count));\nWhat is the average number of dishes per menu page of menu ID12882?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['S K L Enterprises Inc', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"S K L Enterprises Inc\" is the cust_name; total number of pounds refers to Sum(weight)\nWhat is the total number of pounds being transported for S K L Enterprises Inc?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT SUM(T2.weight) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'S K L Enterprises Inc'",
"index": 2731,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['S K L Enterprises Inc', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"S K L Enterprises Inc\" is the cust_name; total number of pounds refers to Sum(weight)\nWhat is the total number of pounds being transported for S K L Enterprises Inc?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['S K L Enterprises Inc', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"S K L Enterprises Inc\" is the cust_name\nAmong the shipments done by Sue Newell, how many of them are for S K L Enterprises Inc?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.cust_name = 'S K L Enterprises Inc' AND T3.first_name = 'Sue' AND T3.last_name = 'Newell'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.cust_name = 'S K L Enterprises Inc' AND T3.first_name = 'Sue' AND T3.last_name = 'Newell'",
"index": 2732,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['S K L Enterprises Inc', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"S K L Enterprises Inc\" is the cust_name\nAmong the shipments done by Sue Newell, how many of them are for S K L Enterprises Inc?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment in 2017 refers to Cast(ship_date AS DATE) = 2017; annual revenue of over 30000000 refers to annual_revenue > 30000000\nAmong the customers having at least one shipment in 2017, how many of them have an annual revenue of over 30000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(COUNTCUSID) FROM ( SELECT COUNT(T1.cust_id) AS COUNTCUSID FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2017' AND T1.annual_revenue > 30000000 GROUP BY T1.cust_id HAVING COUNT(T2.ship_id) >= 1 ) T3",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(COUNTCUSID) FROM ( SELECT COUNT(T1.cust_id) AS COUNTCUSID FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2017' AND T1.annual_revenue > 30000000 GROUP BY T1.cust_id HAVING COUNT(T2.ship_id) >= 1 ) T3",
"index": 2733,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment in 2017 refers to Cast(ship_date AS DATE) = 2017; annual revenue of over 30000000 refers to annual_revenue > 30000000\nAmong the customers having at least one shipment in 2017, how many of them have an annual revenue of over 30000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['North Carolina', 'Washington', 'New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['WA', 'NC', 'TX', 'FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Kenworth', 'Mack', 'Peterbilt']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1045 refers to ship_id = 1045; headquarter refers to if make = 'Peterbit', then 'Texax(TX)', if make = 'Mack', then 'North Carolina (NC)'; if make = 'Kenworth', then 'Washington (WA)'\nState the headquarter of the truck which completed shipment no.1045.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = 1045",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = 1045",
"index": 2734,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['North Carolina', 'Washington', 'New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['WA', 'NC', 'TX', 'FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Kenworth', 'Mack', 'Peterbilt']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1045 refers to ship_id = 1045; headquarter refers to if make = 'Peterbit', then 'Texax(TX)', if make = 'Mack', then 'North Carolina (NC)'; if make = 'Kenworth', then 'Washington (WA)'\nState the headquarter of the truck which completed shipment no.1045.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1275 refers to ship_id = 1275; customer name refers to cust_name\nWho was the customer of shipment no.1275? Give the customer's name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.cust_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.ship_id = '1275'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.cust_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.ship_id = '1275'",
"index": 2735,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1275 refers to ship_id = 1275; customer name refers to cust_name\nWho was the customer of shipment no.1275? Give the customer's name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1021 refers to ship_id = 1021; name refers to first_name, last_name\nGive the name of the driver of shipment no.1021.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1021'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1021'",
"index": 2736,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1021 refers to ship_id = 1021; name refers to first_name, last_name\nGive the name of the driver of shipment no.1021.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment on 2017/11/5 refers to ship_date = '2017-11/05'; name refers to first_name, last_name\nTell the name of the driver who received the shipment on 2017/11/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 T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2017-11-05'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2017-11-05'",
"index": 2737,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment on 2017/11/5 refers to ship_date = '2017-11/05'; name refers to first_name, last_name\nTell the name of the driver who received the shipment on 2017/11/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 truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['South Carolina', 'New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['SC', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"South Carolina\" refers to state = 'SC'; first shipment refers to Min(ship_date)\nProvide the ship date of the first shipment to customers in South Carolina.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MIN(T1.ship_date) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'SC'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT MIN(T1.ship_date) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'SC'",
"index": 2738,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['South Carolina', 'New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['SC', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"South Carolina\" refers to state = 'SC'; first shipment refers to Min(ship_date)\nProvide the ship date of the first shipment to customers in South Carolina.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1346 refers to ship_id = 1346\nWhat is the area of the destination city of shipment No.1346?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.area FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1346'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.area FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1346'",
"index": 2739,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1346 refers to ship_id = 1346\nWhat is the area of the destination city of shipment No.1346?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-09-19', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntruck no. 3 refers to truck_id = 3; on 2016/9/19 refers to ship_date = '2016-09-19'; full name refers to first_name, last_name\nWho was the driver of truck no.3 on 2016/9/19? Tell 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 T3.first_name, T3.last_name FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.truck_id = '3' AND T2.ship_date = '2016-09-19'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T3.first_name, T3.last_name FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T1.truck_id = '3' AND T2.ship_date = '2016-09-19'",
"index": 2740,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-09-19', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntruck no. 3 refers to truck_id = 3; on 2016/9/19 refers to ship_date = '2016-09-19'; full name refers to first_name, last_name\nWho was the driver of truck no.3 on 2016/9/19? Tell 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 customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1369 refers to ship_id = 1369; population density refers to Divide (area, population)\nCalculate the population density of the city as the destination of shipment no.1369.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.area / T2.population FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1369'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.area / T2.population FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_id = '1369'",
"index": 2741,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment no. 1369 refers to ship_id = 1369; population density refers to Divide (area, population)\nCalculate the population density of the city as the destination of shipment no.1369.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst shipment refers to Min(ship_date); pounds refers to weight\nHow many pounds did Sue Newell transport during her first shipment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Sue' AND T2.last_name = 'Newell' ORDER BY T1.ship_date ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.weight FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Sue' AND T2.last_name = 'Newell' ORDER BY T1.ship_date ASC LIMIT 1",
"index": 2742,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst shipment refers to Min(ship_date); pounds refers to weight\nHow many pounds did Sue Newell transport during her first shipment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheaviest shipment refers to Max(weight)\nTo whom did the company transport its heaviest shipment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id ORDER BY T1.weight DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id ORDER BY T1.weight DESC LIMIT 1",
"index": 2743,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheaviest shipment refers to Max(weight)\nTo whom did the company transport its heaviest shipment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst shipment of the company refers to Min(ship_date); full name refers to first_name, last_name\nWhat is the full name of the driver who transported the first shipment of the company?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id ORDER BY T1.ship_date ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id ORDER BY T1.ship_date ASC LIMIT 1",
"index": 2744,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst shipment of the company refers to Min(ship_date); full name refers to first_name, last_name\nWhat is the full name of the driver who transported the first shipment of the company?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Olympic Camper Sales Inc', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Olympic Camper Sales Inc\" is the cust_name\nIn total, how many shipments were transported to Olympic Camper Sales Inc?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ship_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'Olympic Camper Sales Inc'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(T2.ship_id) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T1.cust_name = 'Olympic Camper Sales Inc'",
"index": 2745,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Olympic Camper Sales Inc', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Olympic Camper Sales Inc\" is the cust_name\nIn total, how many shipments were transported to Olympic Camper Sales Inc?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: [\"Harry's Hot Rod Auto & Truck Accessories\", 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['New York', 'Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" is the city_name; 'Harry's Hot Rod Auto & Truck Accessories' is the cust_name\nHow many of the shipments bound for New York City were shipped to Harry's Hot Rod Auto and Truck Accessories?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T3.city_name = 'New York' AND T1.cust_name = 'Harry''s Hot Rod Auto & Truck Accessories'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T3.city_name = 'New York' AND T1.cust_name = 'Harry''s Hot Rod Auto & Truck Accessories'",
"index": 2746,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: [\"Harry's Hot Rod Auto & Truck Accessories\", 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['New York', 'Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" is the city_name; 'Harry's Hot Rod Auto & Truck Accessories' is the cust_name\nHow many of the shipments bound for New York City were shipped to Harry's Hot Rod Auto and Truck Accessories?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Mack', 'Peterbilt']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheaviest shipment refers to Max(weight); via Mack refers to make = 'Mack'\nAmong the top 5 heaviest shipments, how many shipments were transported via Mack?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ship_id) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Mack' ORDER BY T2.weight DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(T2.ship_id) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Mack' ORDER BY T2.weight DESC LIMIT 1",
"index": 2747,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Mack', 'Peterbilt']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheaviest shipment refers to Max(weight); via Mack refers to make = 'Mack'\nAmong the top 5 heaviest shipments, how many shipments were transported via Mack?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Downey', 'Union City', 'Huntington Park']\n state text, -- example: ['California', 'New Jersey']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['CA', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Downey\" is the city_name; 'California' is the state, whose abbreviation is CA; in 2016 refers to year(ship_date) = 2016,\nAmong the shipments for Downey, how many shipments were shipped to California in 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T3.cust_id = T1.cust_id WHERE T2.city_name = 'Downey' AND STRFTIME('%Y', T1.ship_date) = '2016' AND T3.state = 'CA'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T3.cust_id = T1.cust_id WHERE T2.city_name = 'Downey' AND STRFTIME('%Y', T1.ship_date) = '2016' AND T3.state = 'CA'",
"index": 2748,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Downey', 'Union City', 'Huntington Park']\n state text, -- example: ['California', 'New Jersey']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['CA', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Downey\" is the city_name; 'California' is the state, whose abbreviation is CA; in 2016 refers to year(ship_date) = 2016,\nAmong the shipments for Downey, how many shipments were shipped to California in 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['North Las Vegas', 'Las Vegas', 'Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Holger', 'Sue', 'Andrea']\n last_name text, -- example: ['Nohr', 'Newell', 'Simons']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"North Las Vegas\" is the city_name\nHow many shipments did Holger Nohr transport to North Las Vegas overall?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 driver AS T1 INNER JOIN shipment AS T2 ON T1.driver_id = T2.driver_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T1.first_name = 'Holger' AND T1.last_name = 'Nohr' AND T3.city_name = 'North Las Vegas'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM driver AS T1 INNER JOIN shipment AS T2 ON T1.driver_id = T2.driver_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id WHERE T1.first_name = 'Holger' AND T1.last_name = 'Nohr' AND T3.city_name = 'North Las Vegas'",
"index": 2749,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['North Las Vegas', 'Las Vegas', 'Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Holger', 'Sue', 'Andrea']\n last_name text, -- example: ['Nohr', 'Newell', 'Simons']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"North Las Vegas\" is the city_name\nHow many shipments did Holger Nohr transport to North Las Vegas overall?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost densely populated city refers to Max(Divide(area, population))\nHow many shipments were shipped to the most densely populated city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id ORDER BY T2.area / T2.population DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id ORDER BY T2.area / T2.population DESC LIMIT 1",
"index": 2750,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost densely populated city refers to Max(Divide(area, population))\nHow many shipments were shipped to the most densely populated city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['Texas', 'New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['TX', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Texas\" refers to state = 'TX'; 'manufacturer' is the cust_type; percentage = Divide (Count(cust_id where state = 'TX'), Count(cust_id)) * 100\nDetermine the percentage of manufacturers who are from Texas among all of Lorenzo's 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 CAST(SUM(CASE WHEN cust_type = 'manufacturer' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer WHERE state = 'TX'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN cust_type = 'manufacturer' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer WHERE state = 'TX'",
"index": 2751,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['Texas', 'New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['TX', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Texas\" refers to state = 'TX'; 'manufacturer' is the cust_type; percentage = Divide (Count(cust_id where state = 'TX'), Count(cust_id)) * 100\nDetermine the percentage of manufacturers who are from Texas among all of Lorenzo's 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 truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['San Mateo', 'Union City', 'Huntington Park']\n state text, -- example: ['California', 'New Jersey']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"San Mateo\" is the city_name; in 2016 refers to Cast(ship_date as DATE) = 2016\nIdentify the total weight of shipments transported to San Mateo, California, in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.weight) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city_name = 'San Mateo' AND STRFTIME('%Y', T1.ship_date) = '2016'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT SUM(T1.weight) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city_name = 'San Mateo' AND STRFTIME('%Y', T1.ship_date) = '2016'",
"index": 2752,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['San Mateo', 'Union City', 'Huntington Park']\n state text, -- example: ['California', 'New Jersey']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"San Mateo\" is the city_name; in 2016 refers to Cast(ship_date as DATE) = 2016\nIdentify the total weight of shipments transported to San Mateo, California, in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['Boston', 'West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Boston', 'Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Boston\" is the city_name; maximum weight refers to Max(weight); customer refers to cust_name\nWhat was the maximum weight of the shipment carried to Boston? Name the customer of that shipment.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight, T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T1.city_id WHERE T3.city_name = 'Boston' ORDER BY T1.weight DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.weight, T2.cust_name FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id INNER JOIN city AS T3 ON T3.city_id = T1.city_id WHERE T3.city_name = 'Boston' ORDER BY T1.weight DESC LIMIT 1",
"index": 2753,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['Boston', 'West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Boston', 'Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Boston\" is the city_name; maximum weight refers to Max(weight); customer refers to cust_name\nWhat was the maximum weight of the shipment carried to Boston? Name the customer of that shipment.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Mack', 'Peterbilt']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Mack\" is the make; oldest refers to Min(model_year); average shipment weight refers to AVG(weight)\nWhat is the average shipment weight carried by the oldest Mack?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T2.weight) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Mack'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT AVG(T2.weight) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T1.make = 'Mack'",
"index": 2754,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Mack', 'Peterbilt']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Mack\" is the make; oldest refers to Min(model_year); average shipment weight refers to AVG(weight)\nWhat is the average shipment weight carried by the oldest Mack?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Huntsville', 'Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Andrea', 'Sue']\n last_name text, -- example: ['Simons', 'Newell']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Huntsville\" is the city_name; in 2016 refers to Cast(ship_date AS DATE) = 2016; number of shipment refers to Count(ship_id)\nDetermine the number of shipments delivered by Andrea Simons to Huntsville in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id WHERE T3.first_name = 'Andrea' AND T3.last_name = 'Simons' AND T2.city_name = 'Huntsville' AND STRFTIME('%Y', T1.ship_date) = '2016'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id WHERE T3.first_name = 'Andrea' AND T3.last_name = 'Simons' AND T2.city_name = 'Huntsville' AND STRFTIME('%Y', T1.ship_date) = '2016'",
"index": 2755,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Huntsville', 'Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Andrea', 'Sue']\n last_name text, -- example: ['Simons', 'Newell']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Huntsville\" is the city_name; in 2016 refers to Cast(ship_date AS DATE) = 2016; number of shipment refers to Count(ship_id)\nDetermine the number of shipments delivered by Andrea Simons to Huntsville in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Sunguard Window Tinting & Truck Accessories\" is the cust_name; weight exceed 10,000 pounds refers to weight > = 10000; in 2017 refers to Cast(ship_date AS DATE) = 2017; percentage = Divide (Sum(weight > = 10000), Sum(weight)) * 100\nAmong all shipments placed by Sunguard Window Tinting & Truck Accessories in 2017, identify the percentage of shipments whose weight exceeded 10,000 pounds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.weight >= 10000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.cust_name = 'Sunguard Window Tinting & Truck Accessories' AND STRFTIME('%Y', T1.ship_date) = '2017'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.weight >= 10000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.cust_name = 'Sunguard Window Tinting & Truck Accessories' AND STRFTIME('%Y', T1.ship_date) = '2017'",
"index": 2756,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Sunguard Window Tinting & Truck Accessories\" is the cust_name; weight exceed 10,000 pounds refers to weight > = 10000; in 2017 refers to Cast(ship_date AS DATE) = 2017; percentage = Divide (Sum(weight > = 10000), Sum(weight)) * 100\nAmong all shipments placed by Sunguard Window Tinting & Truck Accessories in 2017, identify the percentage of shipments whose weight exceeded 10,000 pounds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New Jersey\" is the state; transported weight greater than 20000 refers to Sum(weight) > 20000\nHow many cities which belong to New Jersey have transported weight greater than 20000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM ( SELECT T2.city_id AS CITYID FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.state = 'New Jersey' GROUP BY T2.city_id HAVING SUM(T1.weight) > 20000 )",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ( SELECT T2.city_id AS CITYID FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.state = 'New Jersey' GROUP BY T2.city_id HAVING SUM(T1.weight) > 20000 )",
"index": 2757,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New Jersey\" is the state; transported weight greater than 20000 refers to Sum(weight) > 20000\nHow many cities which belong to New Jersey have transported weight greater than 20000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1003 refers to ship_id = 1003\nWhat is the model year of the truck used in shipment id 1003?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1003'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1003'",
"index": 2758,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1003 refers to ship_id = 1003\nWhat is the model year of the truck used in shipment id 1003?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1028 refers to ship_id = 1028\nWhat is the first name of the driver who transported shipment id 1028?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = 1028",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = 1028",
"index": 2759,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1028 refers to ship_id = 1028\nWhat is the first name of the driver who transported shipment id 1028?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1055 refers to ship_id = 1055\nList out the state of driver who transported the shipment id 1055.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.state FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1055'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.state FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1055'",
"index": 2760,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1055 refers to ship_id = 1055\nList out the state of driver who transported the shipment id 1055.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment with weight greater than 50000 pounds refers to Sum(weight) > 50000\nState the address of drivers who transported the shipment with weight greater than 50000 pounds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.address FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id GROUP BY T2.driver_id HAVING SUM(T1.weight) > 50000",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.address FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id GROUP BY T2.driver_id HAVING SUM(T1.weight) > 50000",
"index": 2761,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment with weight greater than 50000 pounds refers to Sum(weight) > 50000\nState the address of drivers who transported the shipment with weight greater than 50000 pounds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-02-03', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 3/2/2016 refers to ship_date = '2016-02-03'; full name refers to first_name, last_name\nGive the full name of driver who transported the items on 3/2/2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2016-03-02'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2016-03-02'",
"index": 2762,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-02-03', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 3/2/2016 refers to ship_date = '2016-02-03'; full name refers to first_name, last_name\nGive the full name of driver who transported the items on 3/2/2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweight of less than 65000 pounds refers to weight < 65000; average annual revenue refers to AVG(annual_revenue)\nWhat is the average annual revenue of customers who have shipment weight of less than 65000 pounds?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.annual_revenue) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.weight < 65000",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT AVG(T1.annual_revenue) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.weight < 65000",
"index": 2763,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweight of less than 65000 pounds refers to weight < 65000; average annual revenue refers to AVG(annual_revenue)\nWhat is the average annual revenue of customers who have shipment weight of less than 65000 pounds?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1088 refers to ship_id = 1088\nWhat is the last name of driver who transported shipment id 1088?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1088'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_id = '1088'",
"index": 2764,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1088 refers to ship_id = 1088\nWhat is the last name of driver who transported shipment id 1088?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment weight of greater than 20000 pounds refers to Sum(weight) > 20000\nGive the phone of drivers who transported shipment weight of greater than 20000 pounds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.phone FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id GROUP BY T2.driver_id HAVING SUM(T1.weight) > 20000",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.phone FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id GROUP BY T2.driver_id HAVING SUM(T1.weight) > 20000",
"index": 2765,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment weight of greater than 20000 pounds refers to Sum(weight) > 20000\nGive the phone of drivers who transported shipment weight of greater than 20000 pounds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1055 refers to ship_id = 1055; brand refers to make; model refers to model_year\nWhat is the brand and model of truck used in shipment id 1055?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.make, T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1055'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.make, T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1055'",
"index": 2766,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipment id 1055 refers to ship_id = 1055; brand refers to make; model refers to model_year\nWhat is the brand and model of truck used in shipment id 1055?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmanufactured in year 2009 refers to model_year = 2009\nHow many trucks were manufactured in year 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(truck_id) FROM truck WHERE model_year = 2009",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(truck_id) FROM truck WHERE model_year = 2009",
"index": 2767,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmanufactured in year 2009 refers to model_year = 2009\nHow many trucks were manufactured in year 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"manufacturer\" is the cust_type\nHow many customers are manufacturer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 customer WHERE cust_type = 'manufacturer'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer WHERE cust_type = 'manufacturer'",
"index": 2768,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"manufacturer\" is the cust_type\nHow many customers are manufacturer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['retailer', 'manufacturer', 'wholesaler']\n state text, -- example: ['CA', 'FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['California', 'New Jersey']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"retailer\" is the cust_type; live in California refers to state = 'CA'\nHow many customers who live in California that are retailers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 customer WHERE cust_type = 'retailer' AND state = 'CA'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer WHERE cust_type = 'retailer' AND state = 'CA'",
"index": 2769,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['retailer', 'manufacturer', 'wholesaler']\n state text, -- example: ['CA', 'FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['California', 'New Jersey']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"retailer\" is the cust_type; live in California refers to state = 'CA'\nHow many customers who live in California that are retailers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['Connecticut', 'New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Connecticut\" is the state\nHow many cities are in Connecticut?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 city WHERE state = 'Connecticut'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM city WHERE state = 'Connecticut'",
"index": 2770,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['Connecticut', 'New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Connecticut\" is the state\nHow many cities are in Connecticut?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Klett & Sons Repair', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Klett & Sons Repair\" is the cust_name\nWhat is the annual revenue of Klett & Sons Repair?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT annual_revenue FROM customer WHERE cust_name = 'Klett & Sons Repair'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT annual_revenue FROM customer WHERE cust_name = 'Klett & Sons Repair'",
"index": 2771,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Klett & Sons Repair', 'Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Klett & Sons Repair\" is the cust_name\nWhat is the annual revenue of Klett & Sons Repair?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlightest weight refers to Min(weight); full name refers to first_name, last_name\nWho is the driver that transported the lightest weight of shipment? Provide the full name of the driver.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id ORDER BY T1.weight ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id ORDER BY T1.weight ASC LIMIT 1",
"index": 2772,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlightest weight refers to Min(weight); full name refers to first_name, last_name\nWho is the driver that transported the lightest weight of shipment? Provide the full name of the driver.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['CA', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['California', 'New Jersey']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nliving in California refers to state = 'CA'; in year 2016 refers to CAST(ship_date AS DATE) = 2016\nHow many shipments were shipped to customers living in California in year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) AS per FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2016' AND T1.state = 'CA'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) AS per FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE STRFTIME('%Y', T2.ship_date) = '2016' AND T1.state = 'CA'",
"index": 2773,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['CA', 'FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['California', 'New Jersey']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nliving in California refers to state = 'CA'; in year 2016 refers to CAST(ship_date AS DATE) = 2016\nHow many shipments were shipped to customers living in California in year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Zachery', 'Sue', 'Andrea']\n last_name text, -- example: ['Hicks', 'Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrand of truck refers to make\nWhat is the brand of the truck that is used to ship by Zachery Hicks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT DISTINCT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks'",
"index": 2774,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Zachery', 'Sue', 'Andrea']\n last_name text, -- example: ['Hicks', 'Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrand of truck refers to make\nWhat is the brand of the truck that is used to ship by Zachery Hicks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Zachery', 'Sue', 'Andrea']\n last_name text, -- example: ['Hicks', 'Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['New York', 'Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" is the city_name; in 2016 refers to CAST(ship_date AS DATE) = 2016\nHow many shipments did Zachery Hicks transport goods to New York in the year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM city AS T1 INNER JOIN shipment AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks' AND T1.city_name = 'New York' AND STRFTIME('%Y', T2.ship_date) = '2016'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM city AS T1 INNER JOIN shipment AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks' AND T1.city_name = 'New York' AND STRFTIME('%Y', T2.ship_date) = '2016'",
"index": 2775,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Zachery', 'Sue', 'Andrea']\n last_name text, -- example: ['Hicks', 'Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['New York', 'Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" is the city_name; in 2016 refers to CAST(ship_date AS DATE) = 2016\nHow many shipments did Zachery Hicks transport goods to New York in the year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['North Carolina', 'Washington', 'Texas', 'New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Kenworth', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n state text, -- example: ['WA', 'NC', 'TX', 'FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2016 refers to CAST(ship_date AS DATE) = 2016; make = 'Peterbilt' means headquarter is 'Texas (TX)', make = 'Mack' means headquarter is 'North Carolina (NC)', make = 'Kenworth' means headquarter is 'Washington (WA)'; highest shipment refers to MAX(COUNT(ship_id))\nWhich headquarter's truck has the highest shipments in year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CASE WHEN T2.make = 'Peterbilt' THEN 'Texas (TX)' WHEN T2.make = 'Mack' THEN 'North Carolina (NC)' WHEN T2.make = 'Kenworth' THEN 'Washington (WA)' END AS \"result\" FROM shipment AS T1 INNER JOIN truck AS T2 ON T1.truck_id = T2.truck_id WHERE CAST(T1.ship_date AS DATE) = 2016 GROUP BY T2.make ORDER BY COUNT(T1.ship_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT CASE WHEN T2.make = 'Peterbilt' THEN 'Texas (TX)' WHEN T2.make = 'Mack' THEN 'North Carolina (NC)' WHEN T2.make = 'Kenworth' THEN 'Washington (WA)' END AS \"result\" FROM shipment AS T1 INNER JOIN truck AS T2 ON T1.truck_id = T2.truck_id WHERE CAST(T1.ship_date AS DATE) = 2016 GROUP BY T2.make ORDER BY COUNT(T1.ship_id) DESC LIMIT 1",
"index": 2776,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['North Carolina', 'Washington', 'Texas', 'New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Kenworth', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n last_name text, -- example: ['Newell', 'Simons']\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n state text, -- example: ['WA', 'NC', 'TX', 'FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2016 refers to CAST(ship_date AS DATE) = 2016; make = 'Peterbilt' means headquarter is 'Texas (TX)', make = 'Mack' means headquarter is 'North Carolina (NC)', make = 'Kenworth' means headquarter is 'Washington (WA)'; highest shipment refers to MAX(COUNT(ship_id))\nWhich headquarter's truck has the highest shipments in year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Zachery', 'Sue', 'Andrea']\n last_name text, -- example: ['Hicks', 'Newell', 'Simons']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year 2017 refers to CAST(ship_date AS DATE) = 2017; percentage = Divide (Count(ship_id where first_name = 'Zachery' AND last_name = 'Hicks'), Count(ship_id)) * 100\nCalculate the average number of shipments that Zachery Hicks shipped in year 2017.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.first_name = 'Zachery' AND T2.last_name = 'Hicks' THEN T1.ship_id ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE STRFTIME('%Y', T1.ship_date) = '2017'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.first_name = 'Zachery' AND T2.last_name = 'Hicks' THEN T1.ship_id ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE STRFTIME('%Y', T1.ship_date) = '2017'",
"index": 2777,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Zachery', 'Sue', 'Andrea']\n last_name text, -- example: ['Hicks', 'Newell', 'Simons']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year 2017 refers to CAST(ship_date AS DATE) = 2017; percentage = Divide (Count(ship_id where first_name = 'Zachery' AND last_name = 'Hicks'), Count(ship_id)) * 100\nCalculate the average number of shipments that Zachery Hicks shipped in year 2017.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast populated city refers to Min(population); name refers to first_name, last_name\nList the drivers who shipped the shipments to the least populated city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.first_name, T3.last_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id ORDER BY T2.population ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T3.first_name, T3.last_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id ORDER BY T2.population ASC LIMIT 1",
"index": 2778,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast populated city refers to Min(population); name refers to first_name, last_name\nList the drivers who shipped the shipments to the least populated city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat model year of truck delivered the ship ID 1233?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1233'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1233'",
"index": 2779,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat model year of truck delivered the ship ID 1233?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Maria', 'Sue', 'Andrea']\n last_name text, -- example: ['Craft', 'Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndelivered in 2017 refers to Cast(ship_date AS DATE) = 2017\nAmong the shipments delivered by Maria Craft, how many shipments were delivered in 2017?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Maria' AND T2.last_name = 'Craft' AND STRFTIME('%Y', T1.ship_date) = '2017'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T2.first_name = 'Maria' AND T2.last_name = 'Craft' AND STRFTIME('%Y', T1.ship_date) = '2017'",
"index": 2780,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Maria', 'Sue', 'Andrea']\n last_name text, -- example: ['Craft', 'Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndelivered in 2017 refers to Cast(ship_date AS DATE) = 2017\nAmong the shipments delivered by Maria Craft, how many shipments were delivered in 2017?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the truck's model year used to ship the ship ID 1245?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1245'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1245'",
"index": 2781,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n state text, -- example: ['TN']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the truck's model year used to ship the ship ID 1245?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2017-01-16', '2017-01-12', '2017-01-11', '2017-01-10', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJanuary 16, 2017 refers to ship_date = '2017-01-16'; city refers to city_name\nProvide the destination city of the shipment shipped by January 16, 2017.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.city_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_date = '2017-01-16'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.city_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.ship_date = '2017-01-16'",
"index": 2782,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2017-01-16', '2017-01-12', '2017-01-11', '2017-01-10', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJanuary 16, 2017 refers to ship_date = '2017-01-16'; city refers to city_name\nProvide the destination city of the shipment shipped by January 16, 2017.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost populated city refers to Max(population)\nList the ship ID of shipments shipped to the most populated city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.ship_id FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id ORDER BY T2.population DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T1.ship_id FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id ORDER BY T2.population DESC LIMIT 1",
"index": 2783,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost populated city refers to Max(population)\nList the ship ID of shipments shipped to the most populated city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-02-22', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non February 22, 2016 refers to ship_date = '2016-02-22'; driver's name refers to first_name, last_name\nList the driver's name of the shipment shipped on February 22, 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2016-02-22'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.ship_date = '2016-02-22'",
"index": 2784,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-02-22', '2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non February 22, 2016 refers to ship_date = '2016-02-22'; driver's name refers to first_name, last_name\nList the driver's name of the shipment shipped on February 22, 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the customer's address for the shipment with ship ID 1117?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.address FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T1.ship_id = '1117'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.address FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T1.ship_id = '1117'",
"index": 2785,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 cust_id integer, -- customer id, example: [193, 304]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the customer's address for the shipment with ship ID 1117?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['Texas', 'New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['TX', 'FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Texas\" refers to state = 'TX'; shipped in 2017 refers to CAST(ship_date AS DATE) = 2017; percentage = Divide (Count (ship_id where CAST(ship_date AS DATE) = 2017), Count (ship_id)) * 100\nAmong the shipments to a customer from Texas, what percentage of the shipments shipped in 2017?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T1.ship_date) = '2017' THEN 1 ELSE 0 END) AS REAL ) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'TX'",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T1.ship_date) = '2017' THEN 1 ELSE 0 END) AS REAL ) * 100 / COUNT(*) FROM shipment AS T1 INNER JOIN customer AS T2 ON T1.cust_id = T2.cust_id WHERE T2.state = 'TX'",
"index": 2786,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['Texas', 'New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['TX', 'FL', 'UT']\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Texas\" refers to state = 'TX'; shipped in 2017 refers to CAST(ship_date AS DATE) = 2017; percentage = Divide (Count (ship_id where CAST(ship_date AS DATE) = 2017), Count (ship_id)) * 100\nAmong the shipments to a customer from Texas, what percentage of the shipments shipped in 2017?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"2005\" and \"2006\" are both model_year of truck; difference = Subtract (Count (ship_id where model_year = 2005), Count(ship_id where model_year = 2006))\nCalculate the difference between the number of shipments shipped by the truck with the model year 2005 and model year 2006.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.model_year = '2005' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.model_year = '2006' THEN 1 ELSE 0 END) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.model_year = '2005' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.model_year = '2006' THEN 1 ELSE 0 END) FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id",
"index": 2787,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\n\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n annual_revenue integer, -- example: [39588651, 17158109]\n zip real, -- example: [33415.0, 84107.0]\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"2005\" and \"2006\" are both model_year of truck; difference = Subtract (Count (ship_id where model_year = 2005), Count(ship_id where model_year = 2006))\nCalculate the difference between the number of shipments shipped by the truck with the model year 2005 and model year 2006.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweight greater than 95% of average weight refers to weight > Multiply (AVG(weight), 0.95); driver name refers to first_name, last_name\nList the driver's name of the shipment with a weight greater than 95% of the average weight of all shipments.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.weight * 100 > ( SELECT 95 * AVG(weight) FROM shipment )",
"style": "rule"
} | {
"db_id": "shipping.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.weight * 100 > ( SELECT 95 * AVG(weight) FROM shipment )",
"index": 2788,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE driver (\n driver_id integer, -- example: [20, 21]\n first_name text, -- example: ['Sue', 'Andrea']\n last_name text, -- example: ['Newell', 'Simons']\n address text, -- example: ['268 Richmond Ave', '3574 Oak Limb Cv']\n city text, -- example: ['Memphis']\n state text, -- example: ['TN']\n zip_code integer, -- example: [38106, 38135]\n phone text, -- example: ['(901) 774-6569', '(901) 384-0984']\n PRIMARY KEY (driver_id)\n);\n\nCREATE TABLE truck (\n truck_id integer, -- example: [1, 2]\n make text, -- example: ['Peterbilt', 'Mack']\n model_year integer, -- example: [2005, 2006]\n PRIMARY KEY (truck_id)\n);\n\nCREATE TABLE customer (\n cust_id integer, -- customer id, example: [193, 304]\n cust_name text, -- customer name, example: ['Advanced Fabricators', \"Pard's Trailer Sales\"]\n annual_revenue integer, -- example: [39588651, 17158109]\n cust_type text, -- customer type, example: ['manufacturer', 'wholesaler']\n address text, -- example: ['5141 Summit Boulevard', '5910 South 300 West']\n city text, -- example: ['West Palm Beach', 'Salt Lake City']\n state text, -- example: ['FL', 'UT']\n zip real, -- example: [33415.0, 84107.0]\n phone text, -- example: ['(561) 683-3535', '(801) 262-4864']\n PRIMARY KEY (cust_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [100, 101]\n city_name text, -- example: ['Union City', 'Huntington Park']\n state text, -- example: ['New Jersey', 'California']\n population integer, -- example: [67088, 61348]\n area real, -- example: [1.3, 3.0]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE shipment (\n ship_id integer, -- example: [1000, 1001]\n cust_id integer, -- customer id, example: [3660, 2001]\n weight real, -- example: [3528.0, 11394.0]\n truck_id integer, -- example: [1, 2]\n driver_id integer, -- example: [23, 27]\n city_id integer, -- example: [137, 186]\n ship_date text, -- example: ['2016-01-08', '2016-01-18']\n PRIMARY KEY (ship_id),\n CONSTRAINT fk_shipment_cust_id FOREIGN KEY (cust_id) REFERENCES customer (cust_id),\n CONSTRAINT fk_shipment_truck_id FOREIGN KEY (truck_id) REFERENCES truck (truck_id),\n CONSTRAINT fk_shipment_driver_id FOREIGN KEY (driver_id) REFERENCES driver (driver_id),\n CONSTRAINT fk_shipment_city_id FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweight greater than 95% of average weight refers to weight > Multiply (AVG(weight), 0.95); driver name refers to first_name, last_name\nList the driver's name of the shipment with a weight greater than 95% of the average weight of all shipments.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['different', 'wikipedia', 'language', 'catalan', 'longest', 'differ']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'State', 'Title', 'Word', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest title refers to max(length(title))\nName the longest Catalan language Wikipedia page title and state the number of different words in this page.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title, words FROM pages WHERE title = ( SELECT MAX(LENGTH(title)) FROM pages )",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT title, words FROM pages WHERE title = ( SELECT MAX(LENGTH(title)) FROM pages )",
"index": 2789,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['different', 'wikipedia', 'language', 'catalan', 'longest', 'differ']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'State', 'Title', 'Word', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest title refers to max(length(title))\nName the longest Catalan language Wikipedia page title and state the number of different words in this page.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Title', 'ID', 'Catalans', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'language', 'revision', 'catalan', 'title', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrevision page id '16203226' refers to revision = 16203226\nWhat is the title of Catalan language wikipedia page with revision page id '16203226'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM pages WHERE revision = 16203226",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT title FROM pages WHERE revision = 16203226",
"index": 2790,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Title', 'ID', 'Catalans', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'language', 'revision', 'catalan', 'title', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrevision page id '16203226' refers to revision = 16203226\nWhat is the title of Catalan language wikipedia page with revision page id '16203226'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'language', 'revision', 'catalan', 'between', 'titles']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Between', 'Title', 'All', 'ID']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom revision page id 106600 to 106700 refers to revision BETWEEN 106600 AND 106700\nList the titles for all Catalan language wikipedia page from revision page id 106600 to 106700.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM pages WHERE revision BETWEEN 106600 AND 106700",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT title FROM pages WHERE revision BETWEEN 106600 AND 106700",
"index": 2791,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'language', 'revision', 'catalan', 'between', 'titles']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Between', 'Title', 'All', 'ID']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom revision page id 106600 to 106700 refers to revision BETWEEN 106600 AND 106700\nList the titles for all Catalan language wikipedia page from revision page id 106600 to 106700.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appearance', 'wikipedia', 'language', 'catalan', 'decimal', 'appear']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave the appearance of 'decimal' refers to word = 'decimal'\nList the page id of wikipedia about Catalan language which have the appearance of the word 'decimal'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.pid FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'decimal'",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT T2.pid FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'decimal'",
"index": 2792,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appearance', 'wikipedia', 'language', 'catalan', 'decimal', 'appear']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave the appearance of 'decimal' refers to word = 'decimal'\nList the page id of wikipedia about Catalan language which have the appearance of the word 'decimal'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurence', 'appears', 'number', 'appear', 'where', 'occur']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Pages', 'Title', 'Quipu', 'Show', 'Word', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword 'quipu' appears refers to word = 'quipu'\nShow all the title of pages and number of occurences for each page where the word 'quipu' appears.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title, T2.occurrences FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid INNER JOIN words AS T3 ON T2.wid = T3.wid WHERE T3.word = 'quipu'",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT T1.title, T2.occurrences FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid INNER JOIN words AS T3 ON T2.wid = T3.wid WHERE T3.word = 'quipu'",
"index": 2793,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurence', 'appears', 'number', 'appear', 'where', 'occur']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Pages', 'Title', 'Quipu', 'Show', 'Word', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword 'quipu' appears refers to word = 'quipu'\nShow all the title of pages and number of occurences for each page where the word 'quipu' appears.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Title', 'Word', 'Max', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'different', 'language', 'catalan', 'highest', 'differ']\n PRIMARY KEY (wid)\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 of different words refers to max(words)\nWhat is the title of the Catalan language Wikipedia page that has the highest number of different words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM pages WHERE words = ( SELECT MAX(words) FROM pages )",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT title FROM pages WHERE words = ( SELECT MAX(words) FROM pages )",
"index": 2794,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Title', 'Word', 'Max', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'different', 'language', 'catalan', 'highest', 'differ']\n PRIMARY KEY (wid)\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 of different words refers to max(words)\nWhat is the title of the Catalan language Wikipedia page that has the highest number of different words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Arqueozoologia', 'Wikipedia', 'Title', 'PID', 'ID', 'Àbac']\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage id refers to pid; Arqueozoologia refers to title = 'Arqueozoologia'\nWhat is the wikipedia page id of Arqueozoologia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT page FROM pages WHERE title = 'Arqueozoologia'",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT page FROM pages WHERE title = 'Arqueozoologia'",
"index": 2795,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Arqueozoologia', 'Wikipedia', 'Title', 'PID', 'ID', 'Àbac']\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage id refers to pid; Arqueozoologia refers to title = 'Arqueozoologia'\nWhat is the wikipedia page id of Arqueozoologia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'indicate', 'appeared', 'language', 'catalan']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Catalan', 'Abadia', 'Times', 'Title', 'Said', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAbadia refers to title = 'Abadia'; word id refers to wid; the highest amount of times refers to max(occurrences)\nIn Abadia, what is the word id of the of the Catalan language that appeared the highest amount of times? Indicate the how many times did they said word id appeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.wid, T2.occurrences FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Abadia' ORDER BY T2.occurrences DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT T2.wid, T2.occurrences FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Abadia' ORDER BY T2.occurrences DESC LIMIT 1",
"index": 2796,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'indicate', 'appeared', 'language', 'catalan']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Catalan', 'Abadia', 'Times', 'Title', 'Said', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAbadia refers to title = 'Abadia'; word id refers to wid; the highest amount of times refers to max(occurrences)\nIn Abadia, what is the word id of the of the Catalan language that appeared the highest amount of times? Indicate the how many times did they said word id appeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Top 5', 'Pages', 'Title', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'wikipedia', 'different', 'indicate', 'language']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast number of different words refers to min(words); word id refers to wid; appeared the most refers to max(occurrences)\nWhat are the titles of the top 5 Catalan language Wikipedia page with the least number of different words? Indicate each title's word id that has appeared the most in the said pages.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid ORDER BY T1.words LIMIT 5",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT T1.title FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid ORDER BY T1.words LIMIT 5",
"index": 2797,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Top 5', 'Pages', 'Title', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'wikipedia', 'different', 'indicate', 'language']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast number of different words refers to min(words); word id refers to wid; appeared the most refers to max(occurrences)\nWhat are the titles of the top 5 Catalan language Wikipedia page with the least number of different words? Indicate each title's word id that has appeared the most in the said pages.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'language', 'appeared', 'appear', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Times', 'Many', 'Word', 'TiME', 'TIME', 'Time']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntimes appeared refers to occurrences; word pair \"i\" and \"a\" refers to w1st.word = 'i' w2st.word = 'a'\nHow many times did the word pair \"i\" and \"a\" appeared in the Cataln language/page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(occurrences) FROM biwords WHERE w1st = 86 AND w2nd = 109",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT SUM(occurrences) FROM biwords WHERE w1st = 86 AND w2nd = 109",
"index": 2798,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'language', 'appeared', 'appear', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Times', 'Many', 'Word', 'TiME', 'TIME', 'Time']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntimes appeared refers to occurrences; word pair \"i\" and \"a\" refers to w1st.word = 'i' w2st.word = 'a'\nHow many times did the word pair \"i\" and \"a\" appeared in the Cataln language/page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['acampada', 'title', 'refer', 'words', 'total', 'what']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Acampada', 'Title', 'Adam', 'Word', 'Sum', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal word refers to sum(words); title \"Adam\" and \"Acampada\" refers to title IN('Adam','Acampada')\nWhat is the total word of title \"Adam\" and \"Acampada\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(words) FROM pages WHERE title IN ('Adam', 'Acampada')",
"style": "rule"
} | {
"db_id": "language_corpus.sqlite",
"gt_sql": "SELECT SUM(words) FROM pages WHERE title IN ('Adam', 'Acampada')",
"index": 2799,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['acampada', 'title', 'refer', 'words', 'total', 'what']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Acampada', 'Title', 'Adam', 'Word', 'Sum', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal word refers to sum(words); title \"Adam\" and \"Acampada\" refers to title IN('Adam','Acampada')\nWhat is the total word of title \"Adam\" and \"Acampada\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.