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 Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat milk', 'milk', '2% lowfat milk', '1% lowfat cottage cheese']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['or lowfat milk', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['-1% Lowfat Milk-', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['cups', '1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1% lowfat milk is a name of an ingredient; no.1436 recipe refers to recipe_id = 1436; max_qty = min_qty\nHow many cups of 1% lowfat milk should be added to no.1436 recipe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = '1% lowfat milk' AND T2.unit = 'cup(s)' AND T2.recipe_id = 1436", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = '1% lowfat milk' AND T2.unit = 'cup(s)' AND T2.recipe_id = 1436", "index": 4200, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat milk', 'milk', '2% lowfat milk', '1% lowfat cottage cheese']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['or lowfat milk', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['-1% Lowfat Milk-', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['cups', '1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1% lowfat milk is a name of an ingredient; no.1436 recipe refers to recipe_id = 1436; max_qty = min_qty\nHow many cups of 1% lowfat milk should be added to no.1436 recipe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n fiber real, -- example: [0.87, 0.62]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n cook_min integer, -- cooked minute, example: [8, 2]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most total fat refers to MAX(total_fat)\nWhich recipe in the database contains the most total fat? Give its title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1", "index": 4201, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n fiber real, -- example: [0.87, 0.62]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n cook_min integer, -- cooked minute, example: [8, 2]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most total fat refers to MAX(total_fat)\nWhich recipe in the database contains the most total fat? Give its title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n stnd_min integer, -- stand minute, example: [305, 65]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n preparation text, -- example: ['seedless', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['seedless red grapes', 'red grapes', 'grapes', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nseedless red grapes is a name of an ingredient\nHow many times do seedless red grapes appear in the recipes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = 'seedless red grapes'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = 'seedless red grapes'", "index": 4202, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n stnd_min integer, -- stand minute, example: [305, 65]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n preparation text, -- example: ['seedless', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['seedless red grapes', 'red grapes', 'grapes', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nseedless red grapes is a name of an ingredient\nHow many times do seedless red grapes appear in the recipes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno.1397 recipe refers to recipe_id = 1397; optional ingredient refers to optional = 'TRUE'\nState the name of the optional ingredient of no.1397 recipe.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T2.recipe_id = 1397 AND T2.optional = 'TRUE'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T2.recipe_id = 1397 AND T2.optional = 'TRUE'", "index": 4203, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno.1397 recipe refers to recipe_id = 1397; optional ingredient refers to optional = 'TRUE'\nState the name of the optional ingredient of no.1397 recipe.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n sodium real, -- example: [260.78, 46.17]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['frozen raspberries in light syrup', 'frozen raspberries', 'raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrozen raspberries in light syrup is a name of an ingredient; max_qty = min_qty\nWhich recipe needs the most frozen raspberries in light syrup? State its title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T3.name = 'frozen raspberries in light syrup' AND T2.max_qty = T2.min_qty", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T3.name = 'frozen raspberries in light syrup' AND T2.max_qty = T2.min_qty", "index": 4204, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n sodium real, -- example: [260.78, 46.17]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['frozen raspberries in light syrup', 'frozen raspberries', 'raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrozen raspberries in light syrup is a name of an ingredient; max_qty = min_qty\nWhich recipe needs the most frozen raspberries in light syrup? State its title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n vitamin_c real, -- example: [8.89, 13.02]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most widely used ingredient refers to MAX(COUNT(ingredient_id))\nGive the name of the most widely used ingredient.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id GROUP BY T1.name ORDER BY COUNT(T1.name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id GROUP BY T1.name ORDER BY COUNT(T1.name) DESC LIMIT 1", "index": 4205, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n vitamin_c real, -- example: [8.89, 13.02]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most widely used ingredient refers to MAX(COUNT(ingredient_id))\nGive the name of the most widely used ingredient.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['apple juice', 'raspberry', 'couscous', 'apple', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry-Pear Couscous Cake', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n total_fat real, -- example: [11.53, 1.08]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\napple juice is a name of an ingredient; raspberry-pear couscous cake refers to title\nWhat kind of preparation is needed for apple juice to make a raspberry-pear couscous cake?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.preparation FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Raspberry-Pear Couscous Cake' AND T3.name = 'apple juice'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T2.preparation FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Raspberry-Pear Couscous Cake' AND T3.name = 'apple juice'", "index": 4206, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['apple juice', 'raspberry', 'couscous', 'apple', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry-Pear Couscous Cake', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n total_fat real, -- example: [11.53, 1.08]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\napple juice is a name of an ingredient; raspberry-pear couscous cake refers to title\nWhat kind of preparation is needed for apple juice to make a raspberry-pear couscous cake?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['sherry', 'beef', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Sherried Beef', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSherry beef refers to title = 'Sherried Beef'\nHow much Vitamin A is in Sherry beef?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.vitamin_a FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Sherried Beef'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T2.vitamin_a FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Sherried Beef'", "index": 4207, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['sherry', 'beef', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Sherried Beef', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSherry beef refers to title = 'Sherried Beef'\nHow much Vitamin A is in Sherry beef?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n sodium real, -- example: [260.78, 46.17]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most kinds of ingredients refers to MAX(COUNT(recipe_id))\nState the title of the recipe with most kinds of ingredients.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id GROUP BY T1.title ORDER BY COUNT(title) DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id GROUP BY T1.title ORDER BY COUNT(title) DESC LIMIT 1", "index": 4208, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n sodium real, -- example: [260.78, 46.17]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most kinds of ingredients refers to MAX(COUNT(recipe_id))\nState the title of the recipe with most kinds of ingredients.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['spinach', 'lasagne', 'beef', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Beef and Spinach Pita Pockets', 'Lasagne-Spinach Spirals', '-Spinach-', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsodium is a name of an ingredient; calculation = DIVIDE(SUM(title = 'Lasagne-Spinach Spirals' THEN sodium), SUM(title = 'Beef and Spinach Pita Pockets' THEN sodium))\nHow many times is the sodium content in Lasagne-Spinach Spirals to Beef and Spinach Pita Pockets?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title = 'Lasagne-Spinach Spirals' THEN T2.sodium ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.title = 'Beef and Spinach Pita Pockets' THEN T2.sodium ELSE 0 END) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.title = 'Lasagne-Spinach Spirals' THEN T2.sodium ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.title = 'Beef and Spinach Pita Pockets' THEN T2.sodium ELSE 0 END) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id", "index": 4209, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['spinach', 'lasagne', 'beef', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Beef and Spinach Pita Pockets', 'Lasagne-Spinach Spirals', '-Spinach-', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsodium is a name of an ingredient; calculation = DIVIDE(SUM(title = 'Lasagne-Spinach Spirals' THEN sodium), SUM(title = 'Beef and Spinach Pita Pockets' THEN sodium))\nHow many times is the sodium content in Lasagne-Spinach Spirals to Beef and Spinach Pita Pockets?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['coarsely ground black pepper', 'black pepper', 'pepper', 'finely ground black pepper', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n prep_min integer, -- preparation minute, example: [20, 5]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoarsely ground black pepper is a name of an ingredient; calculation = AVG(calories)\nWhat is the average calorie count for all recipes using coarsely ground black pepper?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.calories) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T1.name = 'coarsely ground black pepper'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT AVG(T3.calories) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T1.name = 'coarsely ground black pepper'", "index": 4210, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['coarsely ground black pepper', 'black pepper', 'pepper', 'finely ground black pepper', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n prep_min integer, -- preparation minute, example: [20, 5]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoarsely ground black pepper is a name of an ingredient; calculation = AVG(calories)\nWhat is the average calorie count for all recipes using coarsely ground black pepper?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n iron real, -- example: [0.81, 0.57]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['beef broth', 'broth', 'beef', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_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'cook in beef broth' refers to a preparation\nWhat are the names of the ingredients that need to be cook in beef broth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T2.preparation = 'cooked in beef broth'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T2.preparation = 'cooked in beef broth'", "index": 4211, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n iron real, -- example: [0.81, 0.57]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['beef broth', 'broth', 'beef', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_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'cook in beef broth' refers to a preparation\nWhat are the names of the ingredients that need to be cook in beef broth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the recipes refers to title; best for wound healing refers to MAX(vitamin_c)\nWhat are the names of the top 5 recipes that are best for wound healing?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.vitamin_c DESC LIMIT 5", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.vitamin_c DESC LIMIT 5", "index": 4212, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the recipes refers to title; best for wound healing refers to MAX(vitamin_c)\nWhat are the names of the top 5 recipes that are best for wound healing?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n iron real, -- example: [0.81, 0.57]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ningredient appeared the least in recipes refers to MIN(ingredient_id)\nWhich ingredient appeared the least in recipes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id GROUP BY T2.ingredient_id ORDER BY COUNT(T2.ingredient_id) ASC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id GROUP BY T2.ingredient_id ORDER BY COUNT(T2.ingredient_id) ASC LIMIT 1", "index": 4213, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n iron real, -- example: [0.81, 0.57]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ningredient appeared the least in recipes refers to MIN(ingredient_id)\nWhich ingredient appeared the least in recipes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['No-Bake Chocolate Cheesecake', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['baking products', 'dairy', 'Mexican products']\n name text, -- example: ['chocolate', 'chocolate chip', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbaking product is a category; No-Bake Chocolate Cheesecake refers to title;\nHow many baking product ingredients are there in the No-Bake Chocolate Cheesecake?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T3.category = 'baking products' AND T1.title = 'No-Bake Chocolate Cheesecake'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T3.category = 'baking products' AND T1.title = 'No-Bake Chocolate Cheesecake'", "index": 4214, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['No-Bake Chocolate Cheesecake', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['baking products', 'dairy', 'Mexican products']\n name text, -- example: ['chocolate', 'chocolate chip', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbaking product is a category; No-Bake Chocolate Cheesecake refers to title;\nHow many baking product ingredients are there in the No-Bake Chocolate Cheesecake?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['prepared', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith alcohol content over 10 refers to alcohol > 10; takes the longest to prepare refers to MAX(prep_min)\nAmong the recipes with alcohol content over 10, which recipe takes the longest to prepare?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol > 10 ORDER BY T1.prep_min DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol > 10 ORDER BY T1.prep_min DESC LIMIT 1", "index": 4215, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['prepared', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith alcohol content over 10 refers to alcohol > 10; takes the longest to prepare refers to MAX(prep_min)\nAmong the recipes with alcohol content over 10, which recipe takes the longest to prepare?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest number of ingredients refers to MAX(ingredient_id); total time refers to recipe_id, total time of cooking refers to TOTAL(prep_min, cook_min, stnd_min)\nWhich recipe has the highest number of ingredients? Calculate the said recipe's total time of cooking.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.recipe_id, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id GROUP BY T2.recipe_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T2.recipe_id, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id GROUP BY T2.recipe_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1", "index": 4216, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest number of ingredients refers to MAX(ingredient_id); total time refers to recipe_id, total time of cooking refers to TOTAL(prep_min, cook_min, stnd_min)\nWhich recipe has the highest number of ingredients? Calculate the said recipe's total time of cooking.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['divided', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ningredient appeared the most in recipes refers to MAX(COUNT(ingredient_id)); calculation = MULTIPLY(DIVIDE(COUNT(MAX(ingredient_id)), COUNT(ingredient_id)), 100)\nWhich ingredient appeared the most in recipes? Calculate its amount of appearance in percentage.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.name, CAST(COUNT(T2.ingredient_id) AS FLOAT) * 100 / ( SELECT COUNT(T2.ingredient_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id ) AS \"percentage\" FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id GROUP BY T2.ingredient_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.name, CAST(COUNT(T2.ingredient_id) AS FLOAT) * 100 / ( SELECT COUNT(T2.ingredient_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id ) AS \"percentage\" FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id GROUP BY T2.ingredient_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1", "index": 4217, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['divided', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ningredient appeared the most in recipes refers to MAX(COUNT(ingredient_id)); calculation = MULTIPLY(DIVIDE(COUNT(MAX(ingredient_id)), COUNT(ingredient_id)), 100)\nWhich ingredient appeared the most in recipes? Calculate its amount of appearance in percentage.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest possibility of gaining weight refers to MAX(total_fat); total time refers to recipe_id, total time refers to TOTAL(prep_min, cook_min, stnd_min)\nProvide the title and total time of the recipe which has the highest possibility of gaining weight.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1", "index": 4218, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest possibility of gaining weight refers to MAX(total_fat); total time refers to recipe_id, total time refers to TOTAL(prep_min, cook_min, stnd_min)\nProvide the title and total time of the recipe which has the highest possibility of gaining weight.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Tomato-Cucumber Relish', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n stnd_min integer, -- stand minute, example: [305, 65]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['cucumber', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTomato-Cucumber Relish refers to title\nList the ingredients in Tomato-Cucumber Relish.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Tomato-Cucumber Relish'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Tomato-Cucumber Relish'", "index": 4219, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Tomato-Cucumber Relish', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n stnd_min integer, -- stand minute, example: [305, 65]\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['cucumber', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTomato-Cucumber Relish refers to title\nList the ingredients in Tomato-Cucumber Relish.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncan lead to constipation refers to iron > 20\nName the recipes which can lead to constipation.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20", "index": 4220, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncan lead to constipation refers to iron > 20\nName the recipes which can lead to constipation.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers to title\nHow much fat does the Raspberry Chiffon Pie have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.total_fat FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T2.total_fat FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'", "index": 4221, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers to title\nHow much fat does the Raspberry Chiffon Pie have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers title; percentage calories protein refers to pcnt_cal_prot\nWhat is the percentage calories protein of Raspberry Chiffon Pie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT pcnt_cal_prot FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT pcnt_cal_prot FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'", "index": 4222, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers title; percentage calories protein refers to pcnt_cal_prot\nWhat is the percentage calories protein of Raspberry Chiffon Pie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalcohol free refers to alcohol = 0\nList the names of alcohol free recipes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0", "index": 4223, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalcohol free refers to alcohol = 0\nList the names of alcohol free recipes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest calories refers to MAX(calories)\nWhich recipe has the highest calories?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.calories DESC LIMIT 1", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.calories DESC LIMIT 1", "index": 4224, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest calories refers to MAX(calories)\nWhich recipe has the highest calories?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon-dairy refers to category NOT LIKE '%dairy\"\nHow many recipes are non-dairy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.recipe_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T1.category NOT LIKE '%dairy%'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT COUNT(T2.recipe_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T1.category NOT LIKE '%dairy%'", "index": 4225, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n stnd_min integer, -- stand minute, example: [305, 65]\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon-dairy refers to category NOT LIKE '%dairy\"\nHow many recipes are non-dairy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['apricot', 'yogurt', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Apricot Yogurt Parfaits', 'Raspberry Chiffon Pie']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nApricot Yogurt Parfaits refers to title\nList all the ingredients of Apricot Yogurt Parfaits.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.name, T3.category FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Apricot Yogurt Parfaits'", "style": "rule" }
{ "db_id": "cookbook.sqlite", "gt_sql": "SELECT T3.name, T3.category FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Apricot Yogurt Parfaits'", "index": 4226, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['apricot', 'yogurt', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Apricot Yogurt Parfaits', 'Raspberry Chiffon Pie']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nApricot Yogurt Parfaits refers to title\nList all the ingredients of Apricot Yogurt Parfaits.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest salary refers to MAX(salary); full name = firstname, lastname\nWhich employee has the highest salary? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1", "index": 4227, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest salary refers to MAX(salary); full name = firstname, lastname\nWhich employee has the highest salary? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n state text, -- example: ['NY', 'GA', 'MA']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n performance text, -- example: ['Good', 'Average']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSandy Adams is the fullname of an employee; full name = firstname, lastname; New York refers to state = 'NY'; good job performance refers to performance = 'Good';\nAmong the employees working at the office in New York, how many of them have a good job performance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good'", "index": 4228, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n state text, -- example: ['NY', 'GA', 'MA']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n performance text, -- example: ['Good', 'Average']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSandy Adams is the fullname of an employee; full name = firstname, lastname; New York refers to state = 'NY'; good job performance refers to performance = 'Good';\nAmong the employees working at the office in New York, how many of them have a good job performance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Adams', 'Milgrom']\n firstname text, -- example: ['Sandy', 'Patricia']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSandy Adams is the fullname of an employee; full name = firstname, lastname;\nWhat is the office phone number of the location at which Sandy Adams works?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy'", "index": 4229, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Adams', 'Milgrom']\n firstname text, -- example: ['Sandy', 'Patricia']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSandy Adams is the fullname of an employee; full name = firstname, lastname;\nWhat is the office phone number of the location at which Sandy Adams works?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Johnson', 'Milgrom', 'Adams']\n firstname text, -- example: ['James', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJames Johnson is the fullname of an employee; full name = firstname, lastname; minimum salary refers to minsalary; calculation = SUBTRACT(salary, minsalary)\nHow much higher is James Johnson's salary from the minimum salary of his title?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS diff FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.lastname = 'Johnson' AND T1.firstname = 'James'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS diff FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.lastname = 'Johnson' AND T1.firstname = 'James'", "index": 4230, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Johnson', 'Milgrom', 'Adams']\n firstname text, -- example: ['James', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJames Johnson is the fullname of an employee; full name = firstname, lastname; minimum salary refers to minsalary; calculation = SUBTRACT(salary, minsalary)\nHow much higher is James Johnson's salary from the minimum salary of his title?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['NY', 'GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Trainee', 'Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTrainees is a position title; California refers to state = 'NY'\nAmong the employees who are Trainees, how many of them work in New York?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Trainee' AND T2.state = 'NY'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Trainee' AND T2.state = 'NY'", "index": 4231, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['NY', 'GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Trainee', 'Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTrainees is a position title; California refers to state = 'NY'\nAmong the employees who are Trainees, how many of them work in New York?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n gender text, -- example: ['M', 'F']\n performance text, -- example: ['Good', 'Average']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale employees refers to gender = 'M'; good job performance refers to performance = 'Good'\nPlease list the zip codes of the offices where all the male employees with a good job performance work at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.gender = 'M' AND T1.performance = 'Good'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.gender = 'M' AND T1.performance = 'Good'", "index": 4232, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n gender text, -- example: ['M', 'F']\n performance text, -- example: ['Good', 'Average']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale employees refers to gender = 'M'; good job performance refers to performance = 'Good'\nPlease list the zip codes of the offices where all the male employees with a good job performance work at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Trainee', 'Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE( SUM(salary), COUNT(positiontitle) where positiontitle = 'Trainee'; Trainee is a position title\nWhat is the average salary of the employees who work as a Trainee?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) AS avg FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) AS avg FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'", "index": 4233, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Trainee', 'Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE( SUM(salary), COUNT(positiontitle) where positiontitle = 'Trainee'; Trainee is a position title\nWhat is the average salary of the employees who work as a Trainee?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Rodriguez', 'Milgrom', 'Adams']\n firstname text, -- example: ['Jose', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJose Rodriguez is the fullname of an employee; full name = firstname, lastname; name of city refers to locationcity\nState the name of the city where Jose Rodriguez works.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'", "index": 4234, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Rodriguez', 'Milgrom', 'Adams']\n firstname text, -- example: ['Jose', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJose Rodriguez is the fullname of an employee; full name = firstname, lastname; name of city refers to locationcity\nState the name of the city where Jose Rodriguez works.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Wood', 'Milgrom', 'Adams']\n firstname text, -- example: ['Emily', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEmily Wood is the full name of an employee; full name = firstname, lastname;\nIn which state does Emily Wood work?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.state FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood'", "index": 4235, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Wood', 'Milgrom', 'Adams']\n firstname text, -- example: ['Emily', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEmily Wood is the full name of an employee; full name = firstname, lastname;\nIn which state does Emily Wood work?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n zipcode integer, -- example: [30316, 2190]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Whitehead', 'Milgrom', 'Adams']\n firstname text, -- example: ['David', 'Patricia', 'Sandy']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDavid Whitehead is the full name of an employee; full name = firstname, lastname\nWhat is the education required for David Whitehead to reach his current position?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.educationrequired FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'David' AND T1.lastname = 'Whitehead' AND T1.gender = 'M'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.educationrequired FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'David' AND T1.lastname = 'Whitehead' AND T1.gender = 'M'", "index": 4236, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n zipcode integer, -- example: [30316, 2190]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Whitehead', 'Milgrom', 'Adams']\n firstname text, -- example: ['David', 'Patricia', 'Sandy']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDavid Whitehead is the full name of an employee; full name = firstname, lastname\nWhat is the education required for David Whitehead to reach his current position?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Chicago', 'Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Good', 'Average']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount representatives is a position title; Chicago refers to locationcity = 'Chicago'; good performance refers to performance = 'Good'\nHow many \"account representatives\" are there in Chicago with a good performance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T2.locationcity = 'Chicago' AND T1.performance = 'Good'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T2.locationcity = 'Chicago' AND T1.performance = 'Good'", "index": 4237, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Chicago', 'Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Good', 'Average']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount representatives is a position title; Chicago refers to locationcity = 'Chicago'; good performance refers to performance = 'Good'\nHow many \"account representatives\" are there in Chicago with a good performance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Rodriguez', 'Milgrom', 'Adams']\n firstname text, -- example: ['Jose', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJose Rodriguez is the full name of an employee; full name = firstname, lastname; calculation = DIVIDE(SUBTRACT(maxsalary, salary), salary) * 100\nIf Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT 100 * (CAST(REPLACE(SUBSTR(T2.maxsalary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT 100 * (CAST(REPLACE(SUBSTR(T2.maxsalary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'", "index": 4238, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Rodriguez', 'Milgrom', 'Adams']\n firstname text, -- example: ['Jose', 'Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJose Rodriguez is the full name of an employee; full name = firstname, lastname; calculation = DIVIDE(SUBTRACT(maxsalary, salary), salary) * 100\nIf Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmaximum salary of no more than US$1000,000 refers to maxsalary < '100000';\nHow many positions have a maximum salary of no more than US$1000,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 COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000", "index": 4239, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmaximum salary of no more than US$1000,000 refers to maxsalary < '100000';\nHow many positions have a maximum salary of no more than US$1000,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 employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst-ever employee that was hired refers to MIN(hiredate)\nHow much is the salary of the first ever employee that was hired?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1", "index": 4240, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst-ever employee that was hired refers to MIN(hiredate)\nHow much is the salary of the first ever employee that was hired?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Regional Manager', 'Manager', 'Account Representative']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['M', 'F']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'M'; Regional Managers is a position title\nHow many male Regional Managers are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Regional Manager' AND T1.gender = 'M'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Regional Manager' AND T1.gender = 'M'", "index": 4241, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Regional Manager', 'Manager', 'Account Representative']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['M', 'F']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'M'; Regional Managers is a position title\nHow many male Regional Managers are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Poor', 'Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npoor performing employees refers to performance = 'Poor'; the highest amount of employees refers to MAX(positiontitle)\nWhich position has the highest amount of poor performing employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1", "index": 4242, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n performance text, -- example: ['Poor', 'Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npoor performing employees refers to performance = 'Poor'; the highest amount of employees refers to MAX(positiontitle)\nWhich position has the highest amount of poor performing employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['2 year degree', '6 year degree', '4 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n firstname text, -- example: ['Patricia', 'Sandy']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2 year degree refers to educationrequired = '2 year degree'; female refers to gender = 'F'; the highest number of employees refers to MAX(positionID)\nWhich position has the highest number of female employees with a 2 year degree?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.educationrequired = '2 year degree' AND T1.gender = 'F' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.educationrequired = '2 year degree' AND T1.gender = 'F' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1", "index": 4243, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['2 year degree', '6 year degree', '4 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n firstname text, -- example: ['Patricia', 'Sandy']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2 year degree refers to educationrequired = '2 year degree'; female refers to gender = 'F'; the highest number of employees refers to MAX(positionID)\nWhich position has the highest number of female employees with a 2 year degree?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAccount Representatives is a position title; satisfying performance mostly refers togood performance\nHow many Account Representatives are there in Illinois with satisfying performance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T1.performance = 'Good' AND T2.state = 'IL'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T1.performance = 'Good' AND T2.state = 'IL'", "index": 4244, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n state text, -- example: ['GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAccount Representatives is a position title; satisfying performance mostly refers togood performance\nHow many Account Representatives are there in Illinois with satisfying performance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; the lowest salary refers to MIN(salary)\nMention the employee's full name and performance status who got the lowest in salary per year.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1", "index": 4245, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; the lowest salary refers to MIN(salary)\nMention the employee's full name and performance status who got the lowest in salary per year.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['CA', 'UT', 'CO', 'GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWestern states refers to state = 'CO' OR state = 'UT' OR state = 'CA'; location cities refers to locationcity\nList the location cities in the Western states.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA')", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA')", "index": 4246, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['CA', 'UT', 'CO', 'GA', 'MA']\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWestern states refers to state = 'CO' OR state = 'UT' OR state = 'CA'; location cities refers to locationcity\nList the location cities in the Western states.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Marlin', 'Milgrom', 'Adams']\n firstname text, -- example: ['Bill', 'Patricia', 'Sandy']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBill Marlin is the full name of an employee; full name = firstname, lastname; maximum salary refers to maxsalary; minimum salary refers to minsalary\nWhat are the maximum and minimum salary range and position title of Bill Marlin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin'", "index": 4247, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Marlin', 'Milgrom', 'Adams']\n firstname text, -- example: ['Bill', 'Patricia', 'Sandy']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBill Marlin is the full name of an employee; full name = firstname, lastname; maximum salary refers to maxsalary; minimum salary refers to minsalary\nWhat are the maximum and minimum salary range and position title of Bill Marlin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['New York City', 'Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; New York city refers to locationcity = 'New York City'\nList the full names, gender and positions who's location is in New York 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.firstname, T1.lastname, T1.gender, T3.positiontitle FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.locationcity = 'New York City'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T1.firstname, T1.lastname, T1.gender, T3.positiontitle FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.locationcity = 'New York City'", "index": 4248, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['New York City', 'Atlanta', 'Boston']\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n minsalary text, -- minimum salary, example: ['US$25,000.00', 'US$50,000.00']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; New York city refers to locationcity = 'New York City'\nList the full names, gender and positions who's location is in New York 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 `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['UT', 'GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; Utah refers to state = 'UT'\nMention the full name, hired date and performance status of the employee whose location is in Utah state.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstname, T1.lastname, T1.hiredate, T1.performance FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'UT'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T1.firstname, T1.lastname, T1.hiredate, T1.performance FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'UT'", "index": 4249, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n address text, -- example: ['450 Peachtree Rd', '3 Commons Blvd']\n state text, -- example: ['UT', 'GA', 'MA']\n zipcode integer, -- example: [30316, 2190]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n hiredate text, -- example: ['10/1/04', '1/15/01']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; Utah refers to state = 'UT'\nMention the full name, hired date and performance status of the employee whose location is in Utah state.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Poor', 'Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount representative is a position title; full name = firstname, lastname; poor performance refers to performance = 'Poor'\nWhat is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.educationrequired, T1.firstname, T1.lastname, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Account Representative'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T2.educationrequired, T1.firstname, T1.lastname, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Account Representative'", "index": 4250, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n positiontitle text, -- example: ['Account Representative', 'Manager']\n educationrequired text, -- example: ['4 year degree', '2 year degree']\n maxsalary text, -- maximum salary, example: ['US$75,000.00', 'US$150,000.00']\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n salary text, -- example: ['US$57,500.00', 'US$19,500.00']\n gender text, -- example: ['F', 'M']\n performance text, -- example: ['Poor', 'Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n officephone text, -- example: ['(404)333-5555', '(617)123-4444']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naccount representative is a position title; full name = firstname, lastname; poor performance refers to performance = 'Poor'\nWhat is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['767-74-7373', '000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; ssn = '767-74-7373'\nWrite down the full name, performance status and located city of the employee who's social security number is \"767-74-7373\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstname, T1.lastname, T2.state, T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.ssn = '767-74-7373'", "style": "rule" }
{ "db_id": "human_resources.sqlite", "gt_sql": "SELECT T1.firstname, T1.lastname, T2.state, T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.ssn = '767-74-7373'", "index": 4251, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n ssn text, -- social security number, example: ['767-74-7373', '000-01-0000', '000-02-2222']\n lastname text, -- example: ['Milgrom', 'Adams']\n firstname text, -- example: ['Patricia', 'Sandy']\n performance text, -- example: ['Average', 'Good']\n positionID integer, -- example: [2, 3]\n locationID integer, -- example: [2, 1]\n PRIMARY KEY (ssn),\n CONSTRAINT fk_employee_positionid FOREIGN KEY (positionID) REFERENCES `position` (positionID),\n CONSTRAINT fk_employee_locationid FOREIGN KEY (locationID) REFERENCES location (locationID)\n);\n\nCREATE TABLE `position` (\n positionID integer, -- example: [1, 2]\n PRIMARY KEY (positionID)\n);\n\nCREATE TABLE location (\n locationID integer, -- example: [1, 2]\n locationcity text, -- example: ['Atlanta', 'Boston']\n state text, -- example: ['GA', 'MA']\n PRIMARY KEY (locationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = firstname, lastname; ssn = '767-74-7373'\nWrite down the full name, performance status and located city of the employee who's social security number is \"767-74-7373\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nstart station refers to start_station_name; end station refers to end_station_name;\nWhich trip had the longest duration? State the start and end station.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip )", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip )", "index": 4252, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nstart station refers to start_station_name; end station refers to end_station_name;\nWhich trip had the longest duration? State the start and end station.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_humidity integer, -- example: [57, 50]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe bike was borrowed and returned on a different day implies that start_date and end_date are not equal to each other; where the bike was returned refers to end_station_name;\nName all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, '/') + 1) - SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, ' ') - 5) <> SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, '/') + 1) - SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, ' ') - 5)", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT DISTINCT T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, '/') + 1) - SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, ' ') - 5) <> SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, '/') + 1) - SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, ' ') - 5)", "index": 4253, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_humidity integer, -- example: [57, 50]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe bike was borrowed and returned on a different day implies that start_date and end_date are not equal to each other; where the bike was returned refers to end_station_name;\nName all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe hottest temperature refers to max_temperature_f;\nWhat was the hottest temperature on the day of trip ID 4080?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT MAX(T2.max_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T1.id = 4080", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT MAX(T2.max_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T1.id = 4080", "index": 4254, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe hottest temperature refers to max_temperature_f;\nWhat was the hottest temperature on the day of trip ID 4080?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['Redwood City', 'San Jose']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nRedwood City is the name of the city; trips in August 2013 refers to start_date like '8%2013%';\nAmong the trips in August 2013, how many bikes were borrowed from Redwood 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(T2.start_date) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '8/%/2013%' AND T1.city = 'Redwood City'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(T2.start_date) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '8/%/2013%' AND T1.city = 'Redwood City'", "index": 4255, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['Redwood City', 'San Jose']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nRedwood City is the name of the city; trips in August 2013 refers to start_date like '8%2013%';\nAmong the trips in August 2013, how many bikes were borrowed from Redwood 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 trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe third quarter of year 2013 implies 3 month interval, including July, August, and September of 2013 and refers to date; the average usage of each bike = DIVIDE(SUM(duration), COUNT(bike_id)); the average wind direction = DIVIDE(SUM(wind_dir_degrees), COUNT(date));\nCalculate the average usage of each bike in the third quarter of year 2013. Find the average wind direction within the same period.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.duration), AVG(T2.wind_dir_degrees) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), 1, INSTR(T2.date, '/') - 1) IN ('7', '8', '9') AND SUBSTR(CAST(T2.date AS TEXT), -4) = '2013'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT AVG(T1.duration), AVG(T2.wind_dir_degrees) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), 1, INSTR(T2.date, '/') - 1) IN ('7', '8', '9') AND SUBSTR(CAST(T2.date AS TEXT), -4) = '2013'", "index": 4256, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe third quarter of year 2013 implies 3 month interval, including July, August, and September of 2013 and refers to date; the average usage of each bike = DIVIDE(SUM(duration), COUNT(bike_id)); the average wind direction = DIVIDE(SUM(wind_dir_degrees), COUNT(date));\nCalculate the average usage of each bike in the third quarter of year 2013. Find the average wind direction within the same period.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'Market at 4th', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'Market at 4th', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['2nd at South Park', 'Market at 4th', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nduration in minutes refers to DIVIDE(duration, 60 seconds); 2nd at South Park refers to end_station_name; Market at 4th refers to start_station_name; start_date = '8/29/2013'; end_date = '8/29/2013';\nHow long did it take for bike id 426 to reach 2nd at South Park from Market at 4th on 8/29/2013? Indicate the duration in minutes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(duration AS REAL) / 60 FROM trip WHERE bike_id = 426 AND end_station_name = '2nd at South Park' AND start_station_name = 'Market at 4th' AND start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT CAST(duration AS REAL) / 60 FROM trip WHERE bike_id = 426 AND end_station_name = '2nd at South Park' AND start_station_name = 'Market at 4th' AND start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'", "index": 4257, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'Market at 4th', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'Market at 4th', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['2nd at South Park', 'Market at 4th', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nduration in minutes refers to DIVIDE(duration, 60 seconds); 2nd at South Park refers to end_station_name; Market at 4th refers to start_station_name; start_date = '8/29/2013'; end_date = '8/29/2013';\nHow long did it take for bike id 426 to reach 2nd at South Park from Market at 4th on 8/29/2013? Indicate the duration in minutes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['California Ave Caltrain Station', 'University and Emerson', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['California Ave Caltrain Station', 'University and Emerson', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['California Ave Caltrain Station', 'University and Emerson', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nstart_date = '8/29/2013'; end_date = '8/29/2013'; end_station_name = 'California Ave Caltrain Station'; start_station_name = 'University and Emerson'; who took the longest to arrive refers to MAX(duration);\nOn 8/29/2013, who took the longest to arrive in California Ave Caltrain Station from University and Emerson? Indicate the bike 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 bike_id FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' AND duration = ( SELECT MAX(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' )", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT bike_id FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' AND duration = ( SELECT MAX(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' )", "index": 4258, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['California Ave Caltrain Station', 'University and Emerson', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['California Ave Caltrain Station', 'University and Emerson', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['California Ave Caltrain Station', 'University and Emerson', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nstart_date = '8/29/2013'; end_date = '8/29/2013'; end_station_name = 'California Ave Caltrain Station'; start_station_name = 'University and Emerson'; who took the longest to arrive refers to MAX(duration);\nOn 8/29/2013, who took the longest to arrive in California Ave Caltrain Station from University and Emerson? Indicate the bike 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 trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSan Francico is the name of the city; can hold more than 20 bikes implies dock's capacity and refers to dock_count≥20;\nHow many stations in San Francico can hold more than 20 bikes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 city = 'San Francisco' AND dock_count > 20 THEN 1 ELSE 0 END) FROM station", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(CASE WHEN city = 'San Francisco' AND dock_count > 20 THEN 1 ELSE 0 END) FROM station", "index": 4259, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSan Francico is the name of the city; can hold more than 20 bikes implies dock's capacity and refers to dock_count≥20;\nHow many stations in San Francico can hold more than 20 bikes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n events text, -- example: ['Fog', 'Rain']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_id integer, -- example: [64, 66]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\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:\nthe hottest temperature refers to max_temperature_f;\nWhen was the hottest temperature recorded? If there are multiple dates with the hottest temperature, indicate all of the dates.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT max_temperature_f, date FROM weather WHERE max_temperature_f = ( SELECT MAX(max_temperature_f) FROM weather WHERE max_temperature_f IS NOT NULL AND max_temperature_f IS NOT '' )", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT max_temperature_f, date FROM weather WHERE max_temperature_f = ( SELECT MAX(max_temperature_f) FROM weather WHERE max_temperature_f IS NOT NULL AND max_temperature_f IS NOT '' )", "index": 4260, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n events text, -- example: ['Fog', 'Rain']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_id integer, -- example: [64, 66]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\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:\nthe hottest temperature refers to max_temperature_f;\nWhen was the hottest temperature recorded? If there are multiple dates with the hottest temperature, indicate all of the dates.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe maximum dew point in Fahrenheit degree refers to max_dew_point_f; date = '7/15/2014';\nWhat is the maximum dew point in Fahrenheit degree on 7/15/2014 in the area with a zip code of 94301?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT CASE WHEN date = '7/15/2014' AND zip_code = 94301 THEN max_dew_point_f END FROM weather", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT DISTINCT CASE WHEN date = '7/15/2014' AND zip_code = 94301 THEN max_dew_point_f END FROM weather", "index": 4261, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe maximum dew point in Fahrenheit degree refers to max_dew_point_f; date = '7/15/2014';\nWhat is the maximum dew point in Fahrenheit degree on 7/15/2014 in the area with a zip code of 94301?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n events text, -- example: ['rain', 'Rain', 'Fog']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nevents = 'Rain'; year refers to YEAR(date);\nWhich year experienced the most rain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUBSTR(CAST(date AS TEXT), -4) FROM weather GROUP BY SUBSTR(CAST(date AS TEXT), -4) ORDER BY SUM(CASE WHEN events LIKE '%Rain%' OR events LIKE '%rain%' THEN 1 ELSE 0 END) DESC LIMIT 1", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUBSTR(CAST(date AS TEXT), -4) FROM weather GROUP BY SUBSTR(CAST(date AS TEXT), -4) ORDER BY SUM(CASE WHEN events LIKE '%Rain%' OR events LIKE '%rain%' THEN 1 ELSE 0 END) DESC LIMIT 1", "index": 4262, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n events text, -- example: ['rain', 'Rain', 'Fog']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nevents = 'Rain'; year refers to YEAR(date);\nWhich year experienced the most rain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n cloud_cover integer, -- example: [4, 2]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nlat = '37.789625' and long = '-122.400811' are latitude and longitude coordinates indicating location; started from the station refers to start_station_name; start_date = '10/20/2014'; duration of the fastest trip refers to MIN(duration);\nOn 10/20/2014, what is the duration of the fastest trip which started from the station with latitude and longitudes of 37.789625 and -122.400811, respectively? Indicate the bike 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 MIN(T2.duration), T2.bike_id FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '10/20/2014%' AND T1.lat = 37.789625 AND T1.long = -122.400811", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT MIN(T2.duration), T2.bike_id FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '10/20/2014%' AND T1.lat = 37.789625 AND T1.long = -122.400811", "index": 4263, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n cloud_cover integer, -- example: [4, 2]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nlat = '37.789625' and long = '-122.400811' are latitude and longitude coordinates indicating location; started from the station refers to start_station_name; start_date = '10/20/2014'; duration of the fastest trip refers to MIN(duration);\nOn 10/20/2014, what is the duration of the fastest trip which started from the station with latitude and longitudes of 37.789625 and -122.400811, respectively? Indicate the bike 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 weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['Powell Street BART', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Powell Street BART', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Powell Street BART', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPowell Street refers to start_station_name; bike 496 refers to bike_id = '496'; start_date = '8/29/2013';\nWhat is the maximum humidity in Powell Street BART when bike 496 was borrowed from the station on 8/29/2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.max_humidity FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date LIKE '8/29/2013%' AND T1.bike_id = 496 AND T1.start_station_name = 'Powell Street BART'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T2.max_humidity FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date LIKE '8/29/2013%' AND T1.bike_id = 496 AND T1.start_station_name = 'Powell Street BART'", "index": 4264, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['Powell Street BART', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Powell Street BART', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Powell Street BART', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPowell Street refers to start_station_name; bike 496 refers to bike_id = '496'; start_date = '8/29/2013';\nWhat is the maximum humidity in Powell Street BART when bike 496 was borrowed from the station on 8/29/2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n);\n\nCREATE TABLE weather (\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\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:\nroute implies a course taken in getting from start_station_name to end_station_name; the longest duration refers to MAX(duration);\nWhat is the route that has the longest duration? Indicate the city of where the stations are located.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.start_station_name, T1.end_station_name, T2.city FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name )", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T1.start_station_name, T1.end_station_name, T2.city FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name )", "index": 4265, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n);\n\nCREATE TABLE weather (\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\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:\nroute implies a course taken in getting from start_station_name to end_station_name; the longest duration refers to MAX(duration);\nWhat is the route that has the longest duration? Indicate the city of where the stations are located.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Adobe on Almaden', 'Ryland Park', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['Adobe on Almaden', 'Ryland Park', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Adobe on Almaden', 'Ryland Park', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\ntrips refer to id; DIVIDE(SUM(duration where start_station_name = 'Adobe on Almaden', end_station_name = 'Ryland Park'), COUNT(id));\nWhat is the average duration of trips which are started at Adobe on Almaden station to Ryland Park?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(duration) FROM trip WHERE start_station_name = 'Adobe on Almaden' AND end_station_name = 'Ryland Park'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT AVG(duration) FROM trip WHERE start_station_name = 'Adobe on Almaden' AND end_station_name = 'Ryland Park'", "index": 4266, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Adobe on Almaden', 'Ryland Park', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['Adobe on Almaden', 'Ryland Park', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Adobe on Almaden', 'Ryland Park', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\ntrips refer to id; DIVIDE(SUM(duration where start_station_name = 'Adobe on Almaden', end_station_name = 'Ryland Park'), COUNT(id));\nWhat is the average duration of trips which are started at Adobe on Almaden station to Ryland Park?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['San Jose Diridon Caltrain Station', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\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:\nHow many bikes borrowed can be computed as SUBTRACT(SUM(dock_count), bikes_available where name = 'San Jose Diridon Caltrain Station' and time = '2013/08/29 06:14:01');\nOn 8/29/2013 at 6:14:01 PM, how many bikes were borrowed from San Jose Diridon Caltrain Station?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.dock_count - T2.bikes_available) FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 06:14:01'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(T1.dock_count - T2.bikes_available) FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 06:14:01'", "index": 4267, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['San Jose Diridon Caltrain Station', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\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:\nHow many bikes borrowed can be computed as SUBTRACT(SUM(dock_count), bikes_available where name = 'San Jose Diridon Caltrain Station' and time = '2013/08/29 06:14:01');\nOn 8/29/2013 at 6:14:01 PM, how many bikes were borrowed from San Jose Diridon Caltrain Station?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_humidity integer, -- example: [75, 70]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\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:\nHow many docks were available at the starting station of trip ID 912900?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.docks_available) FROM trip AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.start_station_id WHERE T1.zip_code = 912900", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(T2.docks_available) FROM trip AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.start_station_id WHERE T1.zip_code = 912900", "index": 4268, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_humidity integer, -- example: [75, 70]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\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:\nHow many docks were available at the starting station of trip ID 912900?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['1/1/2014', '8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['5th at Howard', '2nd at Folsom', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['5/31/2014 11:59', '8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['5th at Howard', '2nd at Folsom', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['12/31/2014 11:59', '3/31/2014 11:59', '1/31/2014 11:59', '7/31/2014 11:59', '11/1/2014 0:00', '10/31/2014 11:59']\n end_station_name text, -- example: ['5th at Howard', '2nd at Folsom', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\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:\nthe shortest duration refers to MIN(duration); subscription_type = 'Subscriber', start_station_name = '2nd at Folsom', end_station_name = '5th at Howard'; in 2014 refers to time period between start_date = '1/1/2014 0:00' and end_date = '12/31/2014 11:59; Average duration = DIVIDE(SUM(duration), COUNT(id));\nIn 2014, what is the shortest duration of trips by subscribers which started at 2nd at Folsom and ended in the 5th at Howard stations, and by how much shorter than the average? Give me the minimum temperature, maximum gust speed and weather event on that trip.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.duration) , MIN(T1.duration) - AVG(T1.duration), T2.min_temperature_f FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date = '1/1/2014 0:00' AND T1.end_date = '12/31/2014 11:59' AND T1.start_station_name = '2nd at Folsom' AND T1.end_station_name = '5th at Howard' AND T1.subscription_type = 'Subscriber'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT MIN(T1.duration) , MIN(T1.duration) - AVG(T1.duration), T2.min_temperature_f FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date = '1/1/2014 0:00' AND T1.end_date = '12/31/2014 11:59' AND T1.start_station_name = '2nd at Folsom' AND T1.end_station_name = '5th at Howard' AND T1.subscription_type = 'Subscriber'", "index": 4269, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['1/1/2014', '8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['5th at Howard', '2nd at Folsom', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['5/31/2014 11:59', '8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['5th at Howard', '2nd at Folsom', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['12/31/2014 11:59', '3/31/2014 11:59', '1/31/2014 11:59', '7/31/2014 11:59', '11/1/2014 0:00', '10/31/2014 11:59']\n end_station_name text, -- example: ['5th at Howard', '2nd at Folsom', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\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:\nthe shortest duration refers to MIN(duration); subscription_type = 'Subscriber', start_station_name = '2nd at Folsom', end_station_name = '5th at Howard'; in 2014 refers to time period between start_date = '1/1/2014 0:00' and end_date = '12/31/2014 11:59; Average duration = DIVIDE(SUM(duration), COUNT(id));\nIn 2014, what is the shortest duration of trips by subscribers which started at 2nd at Folsom and ended in the 5th at Howard stations, and by how much shorter than the average? Give me the minimum temperature, maximum gust speed and weather event on that trip.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n mean_humidity integer, -- example: [75, 70]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n cloud_cover integer, -- example: [4, 2]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['12/31/2013 12:59', '8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\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:\ncustomer refers to subscription_type = 'Customer'; subscribers refers to subscription_type = 'Subscriber'; difference = SUBTRACT(SUM(subscription_type = 'Subscriber' t), SUM(subscription_type = 'Customer')); trip in June 2013 refers to start_date BETWEEN '6/1/2013 0:00'AND '6/31/2013 12:59';\nCalculate the difference between the number of customers and the number of subscribers who did the trip in June 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(IIF(subscription_type = 'Subscriber', 1, 0)) - SUM(IIF(subscription_type = 'Customer', 1, 0)) FROM trip WHERE start_date LIKE '6/%/2013%'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(IIF(subscription_type = 'Subscriber', 1, 0)) - SUM(IIF(subscription_type = 'Customer', 1, 0)) FROM trip WHERE start_date LIKE '6/%/2013%'", "index": 4270, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n mean_humidity integer, -- example: [75, 70]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n cloud_cover integer, -- example: [4, 2]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['12/31/2013 12:59', '8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\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:\ncustomer refers to subscription_type = 'Customer'; subscribers refers to subscription_type = 'Subscriber'; difference = SUBTRACT(SUM(subscription_type = 'Subscriber' t), SUM(subscription_type = 'Customer')); trip in June 2013 refers to start_date BETWEEN '6/1/2013 0:00'AND '6/31/2013 12:59';\nCalculate the difference between the number of customers and the number of subscribers who did the trip in June 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfoggy day refers to events = 'fog'; longest ride on a foggy day refers to MAX(duration) where events = 'fog'; mean visibility refers to mean_visibility_miles; mean wind speed refers to mean_wind_speed_mph; weather event refers to events; coordinates refers to (lat, long); start station refers to start_station_id; end station refers to end_station_id;\nFind the longest ride on foggy day. What were the mean visibility, mean wind speed, and weather event during that ride? Also, list the coordinates and names of the start and end stations.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.mean_visibility_miles, T3.mean_wind_speed_mph, T3.events, T1.lat, T1.long , T2.start_station_name, T2.end_station_name FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.events = 'Fog' ORDER BY T2.duration DESC LIMIT 1", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T3.mean_visibility_miles, T3.mean_wind_speed_mph, T3.events, T1.lat, T1.long , T2.start_station_name, T2.end_station_name FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.events = 'Fog' ORDER BY T2.duration DESC LIMIT 1", "index": 4271, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfoggy day refers to events = 'fog'; longest ride on a foggy day refers to MAX(duration) where events = 'fog'; mean visibility refers to mean_visibility_miles; mean wind speed refers to mean_wind_speed_mph; weather event refers to events; coordinates refers to (lat, long); start station refers to start_station_id; end station refers to end_station_id;\nFind the longest ride on foggy day. What were the mean visibility, mean wind speed, and weather event during that ride? Also, list the coordinates and names of the start and end stations.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['rain', 'Rain', 'Fog']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n docks_available integer, -- example: [25, 24]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nrain of more than 0.8 inches refers to events = rain where precipitation_inches>0.8; average ride duration = DIVIDE(SUM(duration), COUNT(duration));\nFind the average ride duration during the rain of more than 0.8 inches.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE (T2.events = 'Rain' AND T2.precipitation_inches > 0.8) OR (T2.events = 'rain' AND T2.precipitation_inches > 0.8)", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE (T2.events = 'Rain' AND T2.precipitation_inches > 0.8) OR (T2.events = 'rain' AND T2.precipitation_inches > 0.8)", "index": 4272, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['rain', 'Rain', 'Fog']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n docks_available integer, -- example: [25, 24]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nrain of more than 0.8 inches refers to events = rain where precipitation_inches>0.8; average ride duration = DIVIDE(SUM(duration), COUNT(duration));\nFind the average ride duration during the rain of more than 0.8 inches.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n bike_id integer, -- example: [288, 321]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n mean_humidity integer, -- example: [75, 70]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarting stations refers to start_station_name; above average duration trips = DIVIDE(SUM(duration), COUNT(main_trip.id))<duration;\nList the name and city of starting stations which has an above-average duration trips.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.start_station_name, T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration > ( SELECT AVG(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name )", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT DISTINCT T1.start_station_name, T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration > ( SELECT AVG(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name )", "index": 4273, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n bike_id integer, -- example: [288, 321]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n mean_humidity integer, -- example: [75, 70]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarting stations refers to start_station_name; above average duration trips = DIVIDE(SUM(duration), COUNT(main_trip.id))<duration;\nList the name and city of starting stations which has an above-average duration trips.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_id integer, -- example: [64, 66]\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n min_humidity integer, -- example: [57, 50]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Francisco', 'San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nstations refers to name; San Francisco refers to city = 'San Francisco'; installed in 2004 refers to installation_date like'%2014';\nHow many stations in San Francisco are installed in 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN city = 'San Francisco' AND SUBSTR(installation_date, -4) = '2014' THEN 1 ELSE 0 END) FROM station", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(CASE WHEN city = 'San Francisco' AND SUBSTR(installation_date, -4) = '2014' THEN 1 ELSE 0 END) FROM station", "index": 4274, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_station_id integer, -- example: [64, 66]\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n min_humidity integer, -- example: [57, 50]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Francisco', 'San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nstations refers to name; San Francisco refers to city = 'San Francisco'; installed in 2004 refers to installation_date like'%2014';\nHow many stations in San Francisco are installed in 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['Mountain View', 'San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2006 refers to start_date LIKE'%2006%'; ended at station refers to end_station_name; Mountain View refers to city = 'Mountain View';\nIn 2006, how many trips ended at stations in Mountain View?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.city) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.end_station_name WHERE T2.city = 'Mountain View' AND T1.start_date LIKE '%2006%'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(T2.city) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.end_station_name WHERE T2.city = 'Mountain View' AND T1.start_date LIKE '%2006%'", "index": 4275, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['Mountain View', 'San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2006 refers to start_date LIKE'%2006%'; ended at station refers to end_station_name; Mountain View refers to city = 'Mountain View';\nIn 2006, how many trips ended at stations in Mountain View?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['South Van Ness at Market', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['South Van Ness at Market', '2nd at South Park']\n subscription_type text, -- example: ['Subscriber', 'Customer']\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:\nstarted at refers to start_station_name; start_station_name = 'South Van Ness at Market'; average duration = DIVIDE(SUM(duration), COUNT(duration));\nPlease calculate the average duration of trips started at South Van Ness at Market in 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 AVG(duration) FROM trip WHERE start_date LIKE '%2015%' AND start_station_name = 'South Van Ness at Market'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT AVG(duration) FROM trip WHERE start_date LIKE '%2015%' AND start_station_name = 'South Van Ness at Market'", "index": 4276, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['South Van Ness at Market', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['South Van Ness at Market', '2nd at South Park']\n subscription_type text, -- example: ['Subscriber', 'Customer']\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:\nstarted at refers to start_station_name; start_station_name = 'South Van Ness at Market'; average duration = DIVIDE(SUM(duration), COUNT(duration));\nPlease calculate the average duration of trips started at South Van Ness at Market in 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 station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_humidity integer, -- example: [93, 90]\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstart station refers to start_station_id; end station refers to end_station_id; start station and end station are the same refers to start_station_id = end_station_id;\nHow many trips which start station and end station are the same?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(IIF(start_station_id = end_station_id, 1, 0)) FROM trip", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(IIF(start_station_id = end_station_id, 1, 0)) FROM trip", "index": 4277, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_humidity integer, -- example: [93, 90]\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstart station refers to start_station_id; end station refers to end_station_id; start station and end station are the same refers to start_station_id = end_station_id;\nHow many trips which start station and end station are the same?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarted refers to start_date; the hottest day refers to max_temperature_f;\nPlease list trips id started on the hottest day.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code ORDER BY T2.max_temperature_f DESC LIMIT 1", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code ORDER BY T2.max_temperature_f DESC LIMIT 1", "index": 4278, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarted refers to start_date; the hottest day refers to max_temperature_f;\nPlease list trips id started on the hottest day.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Customer', 'Subscriber']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['rain', 'Rain', 'Fog']\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2015 refers to end_date like '%2015%'; percentage = DIVIDE(COUNT(events = 'Rain'), COUNT(events));\nIn 2015, what percentage of trips that had the subscription type was Customer and ended on a rainy day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.events = 'Rain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2015' AND T1.subscription_type = 'Customer'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.events = 'Rain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2015' AND T1.subscription_type = 'Customer'", "index": 4279, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Customer', 'Subscriber']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['rain', 'Rain', 'Fog']\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2015 refers to end_date like '%2015%'; percentage = DIVIDE(COUNT(events = 'Rain'), COUNT(events));\nIn 2015, what percentage of trips that had the subscription type was Customer and ended on a rainy day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n bike_id integer, -- example: [288, 321]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\ninstalled after August, 2013 refers to year(installation_date)>2013; in San Jose refers to city = 'San Jose';\nHow many bike stations are installed after August, 2013 in San Jose?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(installation_date) FROM station WHERE city = 'San Jose' AND (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) IN ('8', '9', '10', '11', '12') AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') OR SUBSTR(CAST(installation_date AS TEXT), -4) > '2013'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(installation_date) FROM station WHERE city = 'San Jose' AND (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) IN ('8', '9', '10', '11', '12') AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') OR SUBSTR(CAST(installation_date AS TEXT), -4) > '2013'", "index": 4280, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n bike_id integer, -- example: [288, 321]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\ninstalled after August, 2013 refers to year(installation_date)>2013; in San Jose refers to city = 'San Jose';\nHow many bike stations are installed after August, 2013 in San Jose?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\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:\nsubscriber refers to subscription_type = 'Subscriber'; in August 2013 refers to start_date LIKE'8%' AND start_date LIKE'%2013%'; station that can hold more than 20 bikes refers to dock_count>20;\nHow many trips made by a subscriber started in August, 2013 from a station that can hold more than 20 bikes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM station AS T1 INNER JOIN trip AS T2 ON T1.id = T2.start_station_id WHERE T2.subscription_type = 'Subscriber' AND T2.start_date LIKE '8/%/2013%' AND T1.dock_count > 20", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T1.id = T2.start_station_id WHERE T2.subscription_type = 'Subscriber' AND T2.start_date LIKE '8/%/2013%' AND T1.dock_count > 20", "index": 4281, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n dock_count integer, -- example: [27, 15]\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:\nsubscriber refers to subscription_type = 'Subscriber'; in August 2013 refers to start_date LIKE'8%' AND start_date LIKE'%2013%'; station that can hold more than 20 bikes refers to dock_count>20;\nHow many trips made by a subscriber started in August, 2013 from a station that can hold more than 20 bikes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest duration refers to MAX(duration); starting on a day with a fog refers to start_date where events = 'fog'; in 2013 refers to date LIKE '%2013';\nWhat is the longest duration for a bike trip starting on a day with a fog in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T2.zip_code = 94107", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T2.zip_code = 94107", "index": 4282, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_id integer, -- example: [64, 66]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest duration refers to MAX(duration); starting on a day with a fog refers to start_date where events = 'fog'; in 2013 refers to date LIKE '%2013';\nWhat is the longest duration for a bike trip starting on a day with a fog in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\nbike was borrowed from refers to start_station_id; when the bike station was installed refers to installation_date;\nWhen was the bike station from which the bike was borrowed on trip ID4069 installed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069", "index": 4283, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\nbike was borrowed from refers to start_station_id; when the bike station was installed refers to installation_date;\nWhen was the bike station from which the bike was borrowed on trip ID4069 installed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['2nd at Folsom', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at Folsom', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\nhottest temperature refers to max_temperatutre_f; in 2014 refers to date LIKE '%2014'; started from station refers to start_station_name; start_station_name = '2nd at Folsom';\nOn the day with the hottest temperature ever in 2014, how many bike trips started from the station 2nd at Folsom?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T2.zip_code = 94107 AND T1.start_station_name = '2nd at Folsom' ORDER BY T2.max_temperature_f DESC LIMIT 1", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T2.zip_code = 94107 AND T1.start_station_name = '2nd at Folsom' ORDER BY T2.max_temperature_f DESC LIMIT 1", "index": 4284, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['2nd at Folsom', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n max_humidity integer, -- example: [93, 90]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at Folsom', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\nhottest temperature refers to max_temperatutre_f; in 2014 refers to date LIKE '%2014'; started from station refers to start_station_name; start_station_name = '2nd at Folsom';\nOn the day with the hottest temperature ever in 2014, how many bike trips started from the station 2nd at Folsom?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage duration = DIVIDE(SUM(duration), COUNT(id)); hottest temperature refers to max_temperature_f; in 2014 refers to date LIKE '%2014';\nWhat is the average duration of a bike trip made on the day with the hottest temperature ever in 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T1.start_station_name = '2nd at Folsom' AND T2.max_temperature_f = ( SELECT max_temperature_f FROM weather ORDER BY max_temperature_f DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T1.start_station_name = '2nd at Folsom' AND T2.max_temperature_f = ( SELECT max_temperature_f FROM weather ORDER BY max_temperature_f DESC LIMIT 1 )", "index": 4285, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage duration = DIVIDE(SUM(duration), COUNT(id)); hottest temperature refers to max_temperature_f; in 2014 refers to date LIKE '%2014';\nWhat is the average duration of a bike trip made on the day with the hottest temperature ever in 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_humidity integer, -- example: [75, 70]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['2nd at South Park', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\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:\nend station refers to end_station_name; starting from refers to start_station_name; start_station_name = '2nd at South Park';\nList out all end stations for a bicycle that were making a trip starting from 2nd at South Park station? Only retain the unique value.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 end_station_name FROM trip WHERE start_station_name = '2nd at South Park'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT DISTINCT end_station_name FROM trip WHERE start_station_name = '2nd at South Park'", "index": 4286, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_humidity integer, -- example: [75, 70]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['2nd at South Park', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\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:\nend station refers to end_station_name; starting from refers to start_station_name; start_station_name = '2nd at South Park';\nList out all end stations for a bicycle that were making a trip starting from 2nd at South Park station? Only retain the unique value.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n events text, -- example: ['rain', 'Rain', 'Fog']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['Mountain View', 'San Jose', 'Redwood City']\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:\nrainy days refers to events = 'rain'; Mountain View refers to zip_code = 94041;\nHow many rainy days were recorded in Mountain View?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(IIF(zip_code = 94041 AND events = 'Rain', 1, 0)) FROM weather", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(IIF(zip_code = 94041 AND events = 'Rain', 1, 0)) FROM weather", "index": 4287, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n events text, -- example: ['rain', 'Rain', 'Fog']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['Mountain View', 'San Jose', 'Redwood City']\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:\nrainy days refers to events = 'rain'; Mountain View refers to zip_code = 94041;\nHow many rainy days were recorded in Mountain View?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Francisco', 'San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\ntemperature refers to max_temperature_f; March 2013 refers to date like '3/%/2013'; conversion to Celcius = DIVIDE(SUBTRACT(max_temperature_f, 32), 1.800) as Celsius1; DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.800) as Celsius2; DIVIDE(SUBTRACT(min_temperature_f, 32), 1.800) as Celcius3;\nConvert all temperature recorded at San Francisco city during August 2013 into degree Celsius.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT (max_temperature_f - 32) / 1.8000 , (mean_temperature_f - 32) / 1.8000 , (min_temperature_f - 32) / 1.8000 FROM weather WHERE SUBSTR(CAST(date AS TEXT), 1, INSTR(date, '/') - 1) = '8' AND SUBSTR(CAST(date AS TEXT), -4) = '2013' AND zip_code = 94107", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT (max_temperature_f - 32) / 1.8000 , (mean_temperature_f - 32) / 1.8000 , (min_temperature_f - 32) / 1.8000 FROM weather WHERE SUBSTR(CAST(date AS TEXT), 1, INSTR(date, '/') - 1) = '8' AND SUBSTR(CAST(date AS TEXT), -4) = '2013' AND zip_code = 94107", "index": 4288, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Francisco', 'San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\ntemperature refers to max_temperature_f; March 2013 refers to date like '3/%/2013'; conversion to Celcius = DIVIDE(SUBTRACT(max_temperature_f, 32), 1.800) as Celsius1; DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.800) as Celsius2; DIVIDE(SUBTRACT(min_temperature_f, 32), 1.800) as Celcius3;\nConvert all temperature recorded at San Francisco city during August 2013 into degree Celsius.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmean temperature refers to mean_temperature_f; mean temperature of 20 degree Celsius refers to DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.8) = 20; in 2014 refers to date LIKE'%2015%';\nList out all stations name that having a mean temperature 20 degree Celsius in year 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T2.start_station_name, T2.end_station_name FROM weather AS T1 INNER JOIN trip AS T2 ON T1.zip_code = T2.zip_code WHERE T1.date LIKE '%2014' AND T1.mean_temperature_f = 20 * 1.8 + 32", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT DISTINCT T2.start_station_name, T2.end_station_name FROM weather AS T1 INNER JOIN trip AS T2 ON T1.zip_code = T2.zip_code WHERE T1.date LIKE '%2014' AND T1.mean_temperature_f = 20 * 1.8 + 32", "index": 4289, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n events text, -- example: ['Fog', 'Rain']\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmean temperature refers to mean_temperature_f; mean temperature of 20 degree Celsius refers to DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.8) = 20; in 2014 refers to date LIKE'%2015%';\nList out all stations name that having a mean temperature 20 degree Celsius in year 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nduring August 2013 refers to start_date like '8/%/2013%';\nHow many bicycle trip were made within San Jose city during August 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.city = 'San Jose' AND T2.start_date LIKE '8/%/2013%' AND T2.start_station_name LIKE 'San Jose%' AND T2.end_station_name LIKE 'San Jose%'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.city = 'San Jose' AND T2.start_date LIKE '8/%/2013%' AND T2.start_station_name LIKE 'San Jose%' AND T2.end_station_name LIKE 'San Jose%'", "index": 4290, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nduring August 2013 refers to start_date like '8/%/2013%';\nHow many bicycle trip were made within San Jose city during August 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Market at 4th', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nsubsscriber refers to subscription_type = subscriber; started their trips in refers to start_station_name; start_station_name = 'Market at 4th';\nCount the number of subscribers who started their trips in Market at 4th.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(CASE WHEN subscription_type = 'Subscriber' AND start_station_name = 'Market at 4th' THEN id END) FROM trip", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(CASE WHEN subscription_type = 'Subscriber' AND start_station_name = 'Market at 4th' THEN id END) FROM trip", "index": 4291, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'South Van Ness at Market']\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Market at 4th', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nsubsscriber refers to subscription_type = subscriber; started their trips in refers to start_station_name; start_station_name = 'Market at 4th';\nCount the number of subscribers who started their trips in Market at 4th.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_humidity integer, -- example: [93, 90]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhottest temperature refers to MAX(max_temperature_f);\nHow many subscribers are in the zip code of 94301 and what is the hottest temperature recorded on that zip code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T3.zip_code), T3.max_temperature_f FROM trip AS T2 INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301 AND T2.subscription_type = 'Subscriber' ORDER BY T3.max_temperature_f DESC LIMIT 1", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT COUNT(T3.zip_code), T3.max_temperature_f FROM trip AS T2 INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301 AND T2.subscription_type = 'Subscriber' ORDER BY T3.max_temperature_f DESC LIMIT 1", "index": 4292, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n lat real, -- latitude, example: [37.329732, 37.330698]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n max_humidity integer, -- example: [93, 90]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhottest temperature refers to MAX(max_temperature_f);\nHow many subscribers are in the zip code of 94301 and what is the hottest temperature recorded on that zip code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Francisco', 'San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\ncustomer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; started their trips within refers to start_station_id; percentage ratio = DIVIDE(SUM(subscription_type = 'Customer'), SUM(subscription_type = 'Subscriber')) as percentage;\nWhat is the percentage ration of customers to subscribers that started their trips within the city of San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco'", "index": 4293, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Francisco', 'San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\ncustomer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; started their trips within refers to start_station_id; percentage ratio = DIVIDE(SUM(subscription_type = 'Customer'), SUM(subscription_type = 'Subscriber')) as percentage;\nWhat is the percentage ration of customers to subscribers that started their trips within the city of San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['San Jose Diridon Caltrain Station', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['San Jose Diridon Caltrain Station', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\nnumber of bikes that have been borrowed refers to SUM(bikes_available); San Jose Diridon Caltrain Station refers to name = 'San Jose Diridon Caltrain Station'; station's coordinates refers to (lat, long);\nHow many bikes have been borrowed at San Jose Diridon Caltrain Station on the date and time of 10/20/2013 8:11:01 AM and indicate the station's coordinates.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bikes_available), T1.long, T1.lat FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/10/20 8:11:01' AND T1.name = 'San Jose Diridon Caltrain Station'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT SUM(T2.bikes_available), T1.long, T1.lat FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/10/20 8:11:01' AND T1.name = 'San Jose Diridon Caltrain Station'", "index": 4294, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n bikes_available integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n mean_humidity integer, -- example: [75, 70]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['San Jose Diridon Caltrain Station', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['San Jose Diridon Caltrain Station', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\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:\nnumber of bikes that have been borrowed refers to SUM(bikes_available); San Jose Diridon Caltrain Station refers to name = 'San Jose Diridon Caltrain Station'; station's coordinates refers to (lat, long);\nHow many bikes have been borrowed at San Jose Diridon Caltrain Station on the date and time of 10/20/2013 8:11:01 AM and indicate the station's coordinates.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nwhen the station was first installed refers to installation_date;\nName the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 585842", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T2.city, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 585842", "index": 4295, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_dew_point_f integer, -- max dew point in Fahrenheit degree, example: [61, 57]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n min_humidity integer, -- example: [57, 50]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n max_wind_Speed_mph integer, -- max wind Speed in mph, example: [23, 29]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n max_gust_speed_mph integer, -- max gust Speed in mph, example: [28, 35]\n precipitation_inches text, -- precipitation in inches, example: ['0', '0.23']\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n dock_count integer, -- example: [27, 15]\n city text, -- example: ['San Jose', 'Redwood City']\n installation_date text, -- example: ['8/6/2013', '8/5/2013']\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:\nwhen the station was first installed refers to installation_date;\nName the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Market at 4th', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarted at refers to start_station_name; start_station_name = 'Market at 4th'; location coordinates refers to (lat, long);\nWhich station did the user who started at Market at 4th station ended their trip at the time of 12:45:00 PM and the date of 8/29/2013 and what is the location coordinates of the ending station?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.lat, T1.long FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T2.start_station_name = 'Market at 4th' AND T2.end_date = '8/29/2013 12:45'", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT T1.name, T1.lat, T1.long FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T2.start_station_name = 'Market at 4th' AND T2.end_date = '8/29/2013 12:45'", "index": 4296, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n start_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_date text, -- example: ['8/29/2013 9:11', '8/29/2013 9:42']\n end_station_name text, -- example: ['Market at 4th', '2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n end_station_id integer, -- example: [64, 69]\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE status (\n station_id integer, -- example: [2, 3]\n docks_available integer, -- example: [25, 24]\n `time` text, -- example: ['2013/08/29 12:06:01', '2013/08/29 12:07:01']\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['Market at 4th', 'San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n `date` text, -- example: ['8/29/2013', '8/30/2013']\n max_temperature_f integer, -- max temperature in Fahrenheit degree, example: [74, 78]\n mean_temperature_f integer, -- mean temperature in Fahrenheit degree, example: [68, 69]\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n mean_humidity integer, -- example: [75, 70]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_sea_level_pressure_inches real, -- mean sea level pressure in inches, example: [30.02, 30.0]\n min_sea_level_pressure_inches real, -- min sea level pressure in inches, example: [29.97, 29.93]\n max_visibility_miles integer, -- max visibility in miles, example: [10, 9]\n mean_visibility_miles integer, -- mean visibility in miles, example: [10, 9]\n min_visibility_miles integer, -- min visibility in miles, example: [10, 7]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n cloud_cover integer, -- example: [4, 2]\n events text, -- example: ['Fog', 'Rain']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarted at refers to start_station_name; start_station_name = 'Market at 4th'; location coordinates refers to (lat, long);\nWhich station did the user who started at Market at 4th station ended their trip at the time of 12:45:00 PM and the date of 8/29/2013 and what is the location coordinates of the ending station?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n docks_available integer, -- example: [25, 24]\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoldest temperature refers to min_temperature_f; average coldest temperature refers = AVG(min_temperature_f); stations refers to name; latitude refers to lat; longitude refers to long;\nWhat is the average coldest temperature for the zip code of 94301 and what stations are within the zip code? Include the latitude and longitude as well.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.min_temperature_f), T1.long, T1.lat FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301", "style": "rule" }
{ "db_id": "bike_share_1.sqlite", "gt_sql": "SELECT AVG(T3.min_temperature_f), T1.long, T1.lat FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301", "index": 4297, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE status (\n docks_available integer, -- example: [25, 24]\n);\n\nCREATE TABLE station (\n id integer, -- example: [2, 3]\n name text, -- example: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center']\n lat real, -- latitude, example: [37.329732, 37.330698]\n long real, -- longitude, example: [-121.90178200000001, -121.888979]\n city text, -- example: ['San Jose', 'Redwood City']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE trip (\n id integer, -- example: [4069, 4073]\n duration integer, -- example: [174, 1067]\n start_date text, -- example: ['8/29/2013 9:08', '8/29/2013 9:24']\n start_station_name text, -- example: ['2nd at South Park', 'South Van Ness at Market']\n start_station_id integer, -- example: [64, 66]\n end_station_name text, -- example: ['2nd at South Park', 'San Francisco Caltrain 2 (330 Townsend)']\n bike_id integer, -- example: [288, 321]\n subscription_type text, -- example: ['Subscriber', 'Customer']\n zip_code integer, -- example: [94114, 94703]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE weather (\n min_temperature_f integer, -- min temperature in Fahrenheit degree, example: [61, 60]\n mean_dew_point_f integer, -- mean dew point in Fahrenheit degree, example: [58, 56]\n min_dew_point_f integer, -- min dew point in Fahrenheit degree, example: [56, 54]\n max_humidity integer, -- example: [93, 90]\n max_sea_level_pressure_inches real, -- max sea level pressure in inches, example: [30.07, 30.05]\n mean_wind_speed_mph integer, -- mean wind Speed in mph, example: [11, 13]\n wind_dir_degrees integer, -- wind direction degrees, example: [286, 291]\n zip_code text, -- example: ['94107', '94063']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoldest temperature refers to min_temperature_f; average coldest temperature refers = AVG(min_temperature_f); stations refers to name; latitude refers to lat; longitude refers to long;\nWhat is the average coldest temperature for the zip code of 94301 and what stations are within the zip code? Include the latitude and longitude as well.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 customer_id integer, -- country id, example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_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\"ACADEMY DINOSAUR\" is the title of film\nWhat is the description of the film ACADEMY DINOSAUR?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR'", "style": "rule" }
{ "db_id": "movie_3.sqlite", "gt_sql": "SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR'", "index": 4298, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 customer_id integer, -- country id, example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_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\"ACADEMY DINOSAUR\" is the title of film\nWhat is the description of the film ACADEMY DINOSAUR?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['NC-17', 'PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased in 2006 refers to release_year = 2006; rated Adults Only refers to rating = 'NC-17'\nAmong the films that are released in 2006, how many of them are rated Adults Only in the Motion Picture Association Film Rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(film_id) FROM film WHERE rating = 'NC-17' AND release_year = 2006", "style": "rule" }
{ "db_id": "movie_3.sqlite", "gt_sql": "SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND release_year = 2006", "index": 4299, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['NC-17', 'PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased in 2006 refers to release_year = 2006; rated Adults Only refers to rating = 'NC-17'\nAmong the films that are released in 2006, how many of them are rated Adults Only in the Motion Picture Association Film Rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }