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 Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in 2008 refers to air_date like '2008%'; highest number of votes refers to MAX(votes); maximum star rating refers to stars = 10\nPlease list all of the episodes that aired in 2008 that have the highest number of votes for the maximum star 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 T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' ORDER BY T2.votes DESC LIMIT 1;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' ORDER BY T2.votes DESC LIMIT 1;", "index": 2100, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in 2008 refers to air_date like '2008%'; highest number of votes refers to MAX(votes); maximum star rating refers to stars = 10\nPlease list all of the episodes that aired in 2008 that have the highest number of votes for the maximum star 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" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Take My Life, Please', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisode \"Take My Life, Please\" refers to title = 'Take My Life, Please'\nWhat are the keywords of the episode \"Take My Life, Please\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please';", "index": 2101, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Take My Life, Please', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisode \"Take My Life, Please\" refers to title = 'Take My Life, Please'\nWhat are the keywords of the episode \"Take My Life, Please\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Joel H. Cohen', 'Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Joel H. Cohen', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Joel H. Cohen', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn 2010 refers to year = 2010\nIn 2010, which episode did Joel H. Cohen win an award for?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2010' AND T1.person = 'Joel H. Cohen';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2010' AND T1.person = 'Joel H. Cohen';", "index": 2102, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Joel H. Cohen', 'Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Joel H. Cohen', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Joel H. Cohen', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn 2010 refers to year = 2010\nIn 2010, which episode did Joel H. Cohen win an award for?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['reference to the fantastic four', 'what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10-star refers to stars = 10\nWhat is the number of votes for 10-star for the episode that has the keyword \"reference to the fantastic four\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.votes FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 AND T1.keyword = 'reference to the fantastic four';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.votes FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 AND T1.keyword = 'reference to the fantastic four';", "index": 2103, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['reference to the fantastic four', 'what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10-star refers to stars = 10\nWhat is the number of votes for 10-star for the episode that has the keyword \"reference to the fantastic four\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['The Burns and the Bees', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1-star refers to stars = 1; 10-star refers to stars = 10; episode \"The Burns and the Bees\" refers to title = 'The Burns and the Bees'; difference refers to SUBTRACT(votes when stars = 1, votes when stars = 10)\nWhat is the difference between the number of votes for 1-star vs. 10-star for the episode \"The Burns and the Bees\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T2.stars = 10 THEN T2.votes ELSE 0 END) - SUM(CASE WHEN T2.stars = 1 THEN T2.votes ELSE 0 END) AS Difference FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'The Burns and the Bees';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.stars = 10 THEN T2.votes ELSE 0 END) - SUM(CASE WHEN T2.stars = 1 THEN T2.votes ELSE 0 END) AS Difference FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'The Burns and the Bees';", "index": 2104, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['The Burns and the Bees', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1-star refers to stars = 1; 10-star refers to stars = 10; episode \"The Burns and the Bees\" refers to title = 'The Burns and the Bees'; difference refers to SUBTRACT(votes when stars = 1, votes when stars = 10)\nWhat is the difference between the number of votes for 1-star vs. 10-star for the episode \"The Burns and the Bees\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast popular episode refers to MIN(votes)\nWhat are the keywords of the least popular episode?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ORDER BY T1.votes LIMIT 1;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ORDER BY T1.votes LIMIT 1;", "index": 2105, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast popular episode refers to MIN(votes)\nWhat are the keywords of the least popular episode?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2-star refers to stars = 2; average rating refers to 5 < rating < = 7; more than 20 of 2-star votes refers to votes > 20\nWhat are the episodes that have the average rating with more than 20 of 2-star votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 2 AND T2.votes > 20 AND T1.rating > 5.0 AND T1.rating <= 7.0;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 2 AND T2.votes > 20 AND T1.rating > 5.0 AND T1.rating <= 7.0;", "index": 2106, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2-star refers to stars = 2; average rating refers to 5 < rating < = 7; more than 20 of 2-star votes refers to votes > 20\nWhat are the episodes that have the average rating with more than 20 of 2-star votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlargest number of votes refers to MAX(votes)\nWhich episode has the largest number of votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT episode FROM Episode WHERE votes = ( SELECT MAX(votes) FROM Episode );", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT episode FROM Episode WHERE votes = ( SELECT MAX(votes) FROM Episode );", "index": 2107, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlargest number of votes refers to MAX(votes)\nWhich episode has the largest number of votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom countries other than the USA refers to birth_country ! = 'USA'\nWhat are the roles of the cast and crew from countries other than the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.role FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T1.birth_country != 'USA';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.role FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T1.birth_country != 'USA';", "index": 2108, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom countries other than the USA refers to birth_country ! = 'USA'\nWhat are the roles of the cast and crew from countries other than the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworst rated episode refers to MIN(rating)\nHow many 1 star ratings are there in the worst rated episode of the season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 1 ORDER BY T1.rating LIMIT 1;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 1 ORDER BY T1.rating LIMIT 1;", "index": 2109, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworst rated episode refers to MIN(rating)\nHow many 1 star ratings are there in the worst rated episode of the season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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 \"Outstanding Voice-Over Performance\" refers to award = 'Outstanding Voice-Over Performance'; winner refers to result = 'Winner';\nWhich character did the \"Outstanding Voice-Over Performance\" winner voice?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.award = 'Outstanding Voice-Over Performance' AND T1.result = 'Winner';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT DISTINCT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.award = 'Outstanding Voice-Over Performance' AND T1.result = 'Winner';", "index": 2110, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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 \"Outstanding Voice-Over Performance\" refers to award = 'Outstanding Voice-Over Performance'; winner refers to result = 'Winner';\nWhich character did the \"Outstanding Voice-Over Performance\" winner voice?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Emily Blunt', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Emily Blunt', 'Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the summary of the episode in which Emily Blunt is featured in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.summary FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Emily Blunt';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.summary FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Emily Blunt';", "index": 2111, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Emily Blunt', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Emily Blunt', 'Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the summary of the episode in which Emily Blunt is featured in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naward winner refers to result = 'Winner'\nList all of the award winners' birth 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 T1.birthdate FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Winner';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.birthdate FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Winner';", "index": 2112, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naward winner refers to result = 'Winner'\nList all of the award winners' birth 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 Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['writer', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['writer', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwriter refers to role = 'Writer'; most 10 star votes refers to max(votes) where stars = 10\nWho is the writer for the episode with the most 10 star votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person FROM Credit AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.role = 'Writer' AND T2.stars = 10 GROUP BY T1.person ORDER BY COUNT(*) DESC LIMIT 1;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.person FROM Credit AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.role = 'Writer' AND T2.stars = 10 GROUP BY T1.person ORDER BY COUNT(*) DESC LIMIT 1;", "index": 2113, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['writer', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['writer', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwriter refers to role = 'Writer'; most 10 star votes refers to max(votes) where stars = 10\nWho is the writer for the episode with the most 10 star votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisode 426 refers to number_in_series = 426\nWhat are the keywords for episode 426 of the series?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.number_in_series = 426;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.number_in_series = 426;", "index": 2114, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisode 426 refers to number_in_series = 426\nWhat are the keywords for episode 426 of the series?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisodes that have received more 7-star votes than the season average refers to votes > DIVIDE(SUM(votes), COUNT(stars = 7))\nWhat are the titles of the episodes that have received more 7-star votes than the season average?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 7 AND T2.votes > 0.7 * ( SELECT CAST(COUNT(votes) AS REAL) / COUNT(CASE WHEN stars = 7 THEN 1 ELSE 0 END) FROM Vote );", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 7 AND T2.votes > 0.7 * ( SELECT CAST(COUNT(votes) AS REAL) / COUNT(CASE WHEN stars = 7 THEN 1 ELSE 0 END) FROM Vote );", "index": 2115, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisodes that have received more 7-star votes than the season average refers to votes > DIVIDE(SUM(votes), COUNT(stars = 7))\nWhat are the titles of the episodes that have received more 7-star votes than the season average?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated episodes refers to result = 'Nominee'; percentage of votes = DIVIDE(SUM(result = 'Nominee), SUM(Votes)) as percentage\nWhat percentage of votes are from the nominated episodes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.result = 'Nominee' THEN T2.votes ELSE 0 END) AS REAL) * 100 / SUM(T2.votes) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.result = 'Nominee' THEN T2.votes ELSE 0 END) AS REAL) * 100 / SUM(T2.votes) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id;", "index": 2116, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated episodes refers to result = 'Nominee'; percentage of votes = DIVIDE(SUM(result = 'Nominee), SUM(Votes)) as percentage\nWhat percentage of votes are from the nominated episodes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npeople from USA refers to birth_country = 'USA'; average height = AVG(height_meters)\nWhat is the average height of people from USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(height_meters) FROM Person WHERE birth_country = 'USA';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT AVG(height_meters) FROM Person WHERE birth_country = 'USA';", "index": 2117, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npeople from USA refers to birth_country = 'USA'; average height = AVG(height_meters)\nWhat is the average height of people from USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn after 1970 refers to birthdate > 1970; from California refers to birth_region = 'California'; percentage = divide(count(birthdate > 1970 and birth_region = 'California'), total(birthdate)) * 100%\nCalculate the percentage of people who were born after 1970 and from California.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN birth_region = 'California' AND SUBSTR(birthdate, 1, 4) > '1970' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(birthdate) FROM Person;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN birth_region = 'California' AND SUBSTR(birthdate, 1, 4) > '1970' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(birthdate) FROM Person;", "index": 2118, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn after 1970 refers to birthdate > 1970; from California refers to birth_region = 'California'; percentage = divide(count(birthdate > 1970 and birth_region = 'California'), total(birthdate)) * 100%\nCalculate the percentage of people who were born after 1970 and from California.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E20', 'S20-E13', 'S20-E16', 'S20-E18']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisode S20-E1, S20-E2 & S20-E3 refers to episode_id = 'S20-E1' and episode_id = 'S20-E2' and episode_id = 'S20-E3'\nList down the title of episode S20-E1, S20-E2 & S20-E3.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM Episode WHERE episode_id IN ('S20-E1', 'S20-E2', 'S20-E3');", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT title FROM Episode WHERE episode_id IN ('S20-E1', 'S20-E2', 'S20-E3');", "index": 2119, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E20', 'S20-E13', 'S20-E16', 'S20-E18']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E3', 'S20-E2', 'S20-E1', 'S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisode S20-E1, S20-E2 & S20-E3 refers to episode_id = 'S20-E1' and episode_id = 'S20-E2' and episode_id = 'S20-E3'\nList down the title of episode S20-E1, S20-E2 & S20-E3.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrating of 7 and above refers to rating > 7.0\nState the number of votes for episode with rating of 7 and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT votes FROM Episode WHERE rating > 7;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT votes FROM Episode WHERE rating > 7;", "index": 2120, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrating of 7 and above refers to rating > 7.0\nState the number of votes for episode with rating of 7 and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Cast', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworking from Casting Department refers to category = 'Casting Department'\nHow many title's crew members are working from Casting Department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.category = 'Casting Department';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.category = 'Casting Department';", "index": 2121, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Cast', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworking from Casting Department refers to category = 'Casting Department'\nHow many title's crew members are working from Casting Department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['additional timer', 'casting']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nadditional timers refers to role = 'additional timer'; born in USA refers to birth_country = 'USA'\nHow many additional timers were born in USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.role = 'additional timer' AND T1.birth_country = 'USA';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.role = 'additional timer' AND T1.birth_country = 'USA';", "index": 2122, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['additional timer', 'casting']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nadditional timers refers to role = 'additional timer'; born in USA refers to birth_country = 'USA'\nHow many additional timers were born in USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Animation', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Animation Department', 'Casting Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom Animation Department refers to category = 'Animation Department'; AVG(height_meters) where category = 'Animation Department'\nWhat is the average heights of crew members from Animation Department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.height_meters) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.category = 'Animation Department';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT AVG(T1.height_meters) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.category = 'Animation Department';", "index": 2123, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Animation', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Animation Department', 'Casting Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom Animation Department refers to category = 'Animation Department'; AVG(height_meters) where category = 'Animation Department'\nWhat is the average heights of crew members from Animation Department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Adam Kuhlman', 'Bonita Pietila']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Kuhlman', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAdam Kuhlman had involved refers to person = 'Adam Kuhlman'\nCalculate the total votes of episodes that Adam Kuhlman had involved.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.votes) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Adam Kuhlman';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT SUM(T1.votes) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Adam Kuhlman';", "index": 2124, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Adam Kuhlman', 'Bonita Pietila']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Kuhlman', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAdam Kuhlman had involved refers to person = 'Adam Kuhlman'\nCalculate the total votes of episodes that Adam Kuhlman had involved.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = DIVIDE(SUM(stars = 5), COUNT(stars)) as percentage\nWhat is the percentage of star score 5 that was collected by title \"Sex, Pies and Idiot Scrapes\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Sex, Pies and Idiot Scrapes';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Sex, Pies and Idiot Scrapes';", "index": 2125, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = DIVIDE(SUM(stars = 5), COUNT(stars)) as percentage\nWhat is the percentage of star score 5 that was collected by title \"Sex, Pies and Idiot Scrapes\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Best International TV Series', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinner refers to result = 'Winner'; Best International TV Series in 2017 refers to award = 'Best International TV Series' and year = '2017'\n\n\nWhich title is the winner of Best International TV Series in 2017?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Best International TV Series' AND SUBSTR(T1.year, 1, 4) = '2017';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Best International TV Series' AND SUBSTR(T1.year, 1, 4) = '2017';", "index": 2126, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Best International TV Series', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinner refers to result = 'Winner'; Best International TV Series in 2017 refers to award = 'Best International TV Series' and year = '2017'\n\n\nWhich title is the winner of Best International TV Series in 2017?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['No Loan Again, Naturally', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nscores 5 to 10 refers to TOTAL(percent) where 1 < = stars < 5\nOut of the rating of 6.8 scored by title \"No Loan Again, Naturally\", how many percent of it consists of scores 5 to 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T2.percent) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'No Loan Again, Naturally' AND T1.rating = 6.8 AND T2.stars BETWEEN 5 AND 10;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT SUM(T2.percent) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'No Loan Again, Naturally' AND T1.rating = 6.8 AND T2.stars BETWEEN 5 AND 10;", "index": 2127, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['No Loan Again, Naturally', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nscores 5 to 10 refers to TOTAL(percent) where 1 < = stars < 5\nOut of the rating of 6.8 scored by title \"No Loan Again, Naturally\", how many percent of it consists of scores 5 to 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar score greater than 8 refers to stars > 8\nHow many episodes have the star score greater than 8?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT episode_id) FROM Vote WHERE stars > 8;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(DISTINCT episode_id) FROM Vote WHERE stars > 8;", "index": 2128, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar score greater than 8 refers to stars > 8\nHow many episodes have the star score greater than 8?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['2d animation', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_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 episodes have the keyword \"2d animation\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(episode_id) FROM Keyword WHERE keyword = '2d animation';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(episode_id) FROM Keyword WHERE keyword = '2d animation';", "index": 2129, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['2d animation', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_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 episodes have the keyword \"2d animation\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the organization which hold the award id 328.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT organization FROM Award WHERE award_id = 328;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT organization FROM Award WHERE award_id = 328;", "index": 2130, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the organization which hold the award id 328.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['co-executive producer', 'executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['co-executive producer', 'executive producer', 'producer', 'casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nco-executive producer refers to role = 'co-executive producer'; higher than 1.60 meters refers to height_meters > 1.60\nList out the birth name of crews who are co-executive producer and higher than 1.60 meters.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birth_name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.role = 'co-executive producer' AND T1.height_meters > 1.60;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.birth_name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.role = 'co-executive producer' AND T1.height_meters > 1.60;", "index": 2131, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['co-executive producer', 'executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['co-executive producer', 'executive producer', 'producer', 'casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nco-executive producer refers to role = 'co-executive producer'; higher than 1.60 meters refers to height_meters > 1.60\nList out the birth name of crews who are co-executive producer and higher than 1.60 meters.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominees refers to result = 'Nominee'; born in USA refers to birth_country = 'USA'; percentage = divide(sum(result = 'Nominee' and birth_country = 'USA'), count(Person.name)) * 100%\nCalculate the percentage of the nominees who were born in USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Nominee';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Nominee';", "index": 2132, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominees refers to result = 'Nominee'; born in USA refers to birth_country = 'USA'; percentage = divide(sum(result = 'Nominee' and birth_country = 'USA'), count(Person.name)) * 100%\nCalculate the percentage of the nominees who were born in USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar score greater than 5 refers to stars > 5; have air date in 2008 refers to air_date LIKE '2008%'\nAmong the episodes which have star score greater than 5, how many episodes have air date in 2008?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T2.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE strftime('%Y', T1.air_date) = '2008' AND T2.stars > 5;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE strftime('%Y', T1.air_date) = '2008' AND T2.stars > 5;", "index": 2133, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar score greater than 5 refers to stars > 5; have air date in 2008 refers to air_date LIKE '2008%'\nAmong the episodes which have star score greater than 5, how many episodes have air date in 2008?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2009 refers to year = 2009; name of awarded character refers to character\n\n\nList out the names of the awarded character in the awards held in 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009;", "index": 2134, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2009 refers to year = 2009; name of awarded character refers to character\n\n\nList out the names of the awarded character in the awards held in 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Smithers', 'Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to person; the role Smithers refers to character = 'Smithers'\nWhat is the name of actor who took the role Smithers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.character = 'Smithers';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT DISTINCT T1.person FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.character = 'Smithers';", "index": 2135, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Smithers', 'Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to person; the role Smithers refers to character = 'Smithers'\nWhat is the name of actor who took the role Smithers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar score less than 8 refers to stars < 8; aired in 2009 refers to air_date LIKE '2009%'\nAmong the episodes which have star score less than 8, how many episodes were aired in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T2.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE strftime('%Y', T1.air_date) = '2009' AND T2.stars < 8;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE strftime('%Y', T1.air_date) = '2009' AND T2.stars < 8;", "index": 2136, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstar score less than 8 refers to stars < 8; aired in 2009 refers to air_date LIKE '2009%'\nAmong the episodes which have star score less than 8, how many episodes were aired in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['director', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['director', 'Director', 'casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirector refers to role = 'director'\nState the birth name of crews who are director and have birth country in South Korea.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birth_name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.role = 'director' AND T1.birth_country = 'South Korea';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.birth_name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.role = 'director' AND T1.birth_country = 'South Korea';", "index": 2137, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['director', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['director', 'Director', 'casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirector refers to role = 'director'\nState the birth name of crews who are director and have birth country in South Korea.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrating below 7 refers to rating < 7\nWhat is the total number of episode with a rating below 7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(episode_id) FROM Episode WHERE rating < 7;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(episode_id) FROM Episode WHERE rating < 7;", "index": 2138, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrating below 7 refers to rating < 7\nWhat is the total number of episode with a rating below 7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalifornia refers to birth_region = 'California'; USA refers to birth_country = 'USA'\nList down the names of person born in California, USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT name FROM Person WHERE birth_region = 'California' AND birth_country = 'USA';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT name FROM Person WHERE birth_region = 'California' AND birth_country = 'USA';", "index": 2139, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalifornia refers to birth_region = 'California'; USA refers to birth_country = 'USA'\nList down the names of person born in California, USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon refers to result = 'Winner'; in Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; 2009 refers to year = 2009\nGive the title of the episode won in Primetime Emmy Awards 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.organization = 'Primetime Emmy Awards' AND T1.year = 2009 AND T1.result = 'Winner';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.organization = 'Primetime Emmy Awards' AND T1.year = 2009 AND T1.result = 'Winner';", "index": 2140, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon refers to result = 'Winner'; in Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; 2009 refers to year = 2009\nGive the title of the episode won in Primetime Emmy Awards 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in 2008 refers to air_date LIKE '2008%'; 5 stars and below refers to stars < 5\nList down the episode ID of episodes aired in 2008 with 5 stars and below.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T2.stars < 5;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T2.stars < 5;", "index": 2141, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in 2008 refers to air_date LIKE '2008%'; 5 stars and below refers to stars < 5\nList down the episode ID of episodes aired in 2008 with 5 stars and below.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in 2008 refers to air_date LIKE '2008%'; votes ranges from 920 to 950 refers to votes BETWEEN 920 AND 950\nAmong the episodes aired in 2008 with votes ranges from 920 to 950, list their percent.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.percent FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T1.votes BETWEEN 950 AND 960;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.percent FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T1.votes BETWEEN 950 AND 960;", "index": 2142, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in 2008 refers to air_date LIKE '2008%'; votes ranges from 920 to 950 refers to votes BETWEEN 920 AND 950\nAmong the episodes aired in 2008 with votes ranges from 920 to 950, list their percent.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Bonita Pietila', 'Adam Greeley', 'Adam Klein']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwas credited refers to credited = 'true'; to Bonita Pietila refers to person = 'Bonita Pietila'\nList the episode ID and title of episode where casting was credited to Bonita Pietila.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.episode_id, T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Bonita Pietila' AND T2.role = 'casting';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.episode_id, T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Bonita Pietila' AND T2.role = 'casting';", "index": 2143, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Bonita Pietila', 'Adam Greeley', 'Adam Klein']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwas credited refers to credited = 'true'; to Bonita Pietila refers to person = 'Bonita Pietila'\nList the episode ID and title of episode where casting was credited to Bonita Pietila.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Annie Awards', 'Primetime Emmy Awards']\n award_category text, -- example: ['Annie', 'Primetime Emmy']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; Annie Awards refers to organization = 'Annie Awards'; percent greater than 6 refers to percent > 6\nIn episode nominated in Annie Awards, how many of the episodes have a percent greater than 6?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.organization = 'Annie Awards' AND T1.result = 'Nominee' AND T2.percent > 6;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(*) FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.organization = 'Annie Awards' AND T1.result = 'Nominee' AND T2.percent > 6;", "index": 2144, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Annie Awards', 'Primetime Emmy Awards']\n award_category text, -- example: ['Annie', 'Primetime Emmy']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; Annie Awards refers to organization = 'Annie Awards'; percent greater than 6 refers to percent > 6\nIn episode nominated in Annie Awards, how many of the episodes have a percent greater than 6?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['WGA Award (TV)', 'Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; WGA Award (TV) refers to award_category = 'WGA Award (TV)'; votes greater than 1000 refers to votes > 1000\nWhat is the title of episode nominated for WGA Award (TV) with votes greater than 1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 1000 AND T1.award_category = 'WGA Award (TV)' AND T1.result = 'Nominee';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT DISTINCT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 1000 AND T1.award_category = 'WGA Award (TV)' AND T1.result = 'Nominee';", "index": 2145, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['WGA Award (TV)', 'Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; WGA Award (TV) refers to award_category = 'WGA Award (TV)'; votes greater than 1000 refers to votes > 1000\nWhat is the title of episode nominated for WGA Award (TV) with votes greater than 1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin November 2008 refers to air_date LIKE '2008-11%'\nList the stars of episodes aired in November 2008.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 7) = '2008-11';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 7) = '2008-11';", "index": 2146, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin November 2008 refers to air_date LIKE '2008-11%'\nList the stars of episodes aired in November 2008.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest votes refers to max(votes); nominated refers to result = 'Nominee'\nIn episode with the highest votes, list the category of awards it is nominated for.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.award_category FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.result = 'Nominee' ORDER BY T2.votes DESC LIMIT 1;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT T1.award_category FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.result = 'Nominee' ORDER BY T2.votes DESC LIMIT 1;", "index": 2147, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest votes refers to max(votes); nominated refers to result = 'Nominee'\nIn episode with the highest votes, list the category of awards it is nominated for.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Sam Im', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['additional timer', 'casting']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Sam Im', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2009 refers to air_date LIKE '2009%'; credited refers to credited = 'true'; Sam Im refers to person = 'Sam Im'; for additional timer refers to role = 'additional timer'\nIn episodes aired in 2009, how many of them are credited to Sam Im for additional timer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Sam Im' AND SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.role = 'additional timer';", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Sam Im' AND SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.role = 'additional timer';", "index": 2148, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Sam Im', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['additional timer', 'casting']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Sam Im', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2009 refers to air_date LIKE '2009%'; credited refers to credited = 'true'; Sam Im refers to person = 'Sam Im'; for additional timer refers to role = 'additional timer'\nIn episodes aired in 2009, how many of them are credited to Sam Im for additional timer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['year 2008', 'what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Gone Maggie Gone', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbeing nominated refers to result = 'Nominee'; percentage = divide(count(result = 'Nominee'), count(result)) * 100%\nIn year 2009, what is the percentage of the episode titled by \"Gone Maggie Gone\" being nominated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.result = 'Nominee' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.result = 'Winner' THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.result) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.title = 'Gone Maggie Gone' AND T1.year = 2009;", "style": "rule" }
{ "db_id": "simpson_episodes.sqlite", "gt_sql": "SELECT CAST((SUM(CASE WHEN T1.result = 'Nominee' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.result = 'Winner' THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.result) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.title = 'Gone Maggie Gone' AND T1.year = 2009;", "index": 2149, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['year 2008', 'what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Gone Maggie Gone', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbeing nominated refers to result = 'Nominee'; percentage = divide(count(result = 'Nominee'), count(result)) * 100%\nIn year 2009, what is the percentage of the episode titled by \"Gone Maggie Gone\" being nominated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent from school for the longest time refers to MAX(month)\nFor the students who have been absent from school for the longest time, how many months have they been absent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(month) FROM longest_absense_from_school", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT MAX(month) FROM longest_absense_from_school", "index": 2150, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent from school for the longest time refers to MAX(month)\nFor the students who have been absent from school for the longest time, how many months have they been absent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to the navy department refers to organ = 'navy';\nHow many students belong to the navy department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ = 'navy'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ = 'navy'", "index": 2151, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to the navy department refers to organ = 'navy';\nHow many students belong to the navy department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent from school for more than 5 months refers to `month`  > = 5;\nAmong the students that have been absent from school for more than 5 months, how many of them are male?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM longest_absense_from_school AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` >= 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` >= 5", "index": 2152, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent from school for more than 5 months refers to `month`  > = 5;\nAmong the students that have been absent from school for more than 5 months, how many of them are male?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to the navy department refers to organ = 'navy';\nPlease list the names of the male students that belong to the navy department.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 enlist AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'navy'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM enlist AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'navy'", "index": 2153, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to the navy department refers to organ = 'navy';\nPlease list the names of the male students that belong to the navy department.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent from school for over 5 months refers to `month` > 5;\nAmong the students that have filed for bankruptcy, how many of them have been absent from school for over 5 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM filed_for_bankrupcy AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.`name` = T2.`name` WHERE T2.`month` > 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.`name` = T2.`name` WHERE T2.`month` > 5", "index": 2154, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent from school for over 5 months refers to `month` > 5;\nAmong the students that have filed for bankruptcy, how many of them have been absent from school for over 5 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nare unemployed and have payment due refers to\nHow many students are unemployed and have payment due?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.`name` = T2.`name`", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.`name` = T2.`name`", "index": 2155, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nare unemployed and have payment due refers to\nHow many students are unemployed and have payment due?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnavy department refers to organ = 'navy'; longest time to be absent from school refers to MAX(month)\nWhat is the longest time for a student from the navy department to be absent from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.month FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy' ORDER BY T1.`month` DESC LIMIT 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.month FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy' ORDER BY T1.`month` DESC LIMIT 1", "index": 2156, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnavy department refers to organ = 'navy'; longest time to be absent from school refers to MAX(month)\nWhat is the longest time for a student from the navy department to be absent from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnever been absent from school refers to month = 0\nHow many disabled students have never been absent from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` = 0", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` = 0", "index": 2157, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnever been absent from school refers to month = 0\nHow many disabled students have never been absent from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndepartment refers to organ; most disabled students refers to MAX(disabled.name)\nWhich department has the most disabled students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.organ, COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` GROUP BY T2.organ ORDER BY COUNT(T1.name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T2.organ, COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` GROUP BY T2.organ ORDER BY COUNT(T1.name) DESC LIMIT 1", "index": 2158, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndepartment refers to organ; most disabled students refers to MAX(disabled.name)\nWhich department has the most disabled students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage time refers to DIVIDE(SUM(`month`), COUNT(name))\nWhat is the average time for a disabled student to be absent from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name`", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name`", "index": 2159, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage time refers to DIVIDE(SUM(`month`), COUNT(name))\nWhat is the average time for a disabled student to be absent from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['foreign_legion', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the foreign legion organ = 'foreign_legion';\nName all students enlisted in the foreign legion.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT name FROM enlist WHERE organ = 'foreign_legion'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT name FROM enlist WHERE organ = 'foreign_legion'", "index": 2160, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['foreign_legion', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the foreign legion organ = 'foreign_legion';\nName all students enlisted in the foreign legion.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student829', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student829', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student829', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student829', 'student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich school is student829 enrolled in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT school FROM enrolled WHERE name = 'student829'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT school FROM enrolled WHERE name = 'student829'", "index": 2161, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student829', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student829', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student829', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student829', 'student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich school is student829 enrolled in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student217', 'student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student217', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student217', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student217', 'student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student217', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\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 months has student217 been absent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT month FROM longest_absense_from_school WHERE name = 'student217'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT month FROM longest_absense_from_school WHERE name = 'student217'", "index": 2162, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student217', 'student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student217', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student217', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student217', 'student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student217', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\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 months has student217 been absent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent for 6 months `month` = 6;\nList all students that have been absent for 6 months.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT name FROM longest_absense_from_school WHERE `month` = 6", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT name FROM longest_absense_from_school WHERE `month` = 6", "index": 2163, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent for 6 months `month` = 6;\nList all students that have been absent for 6 months.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student285', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student285', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student285', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student285', 'student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student285', 'student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich organization did student285 enlist?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT organ FROM enlist WHERE name = 'student285'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT organ FROM enlist WHERE name = 'student285'", "index": 2164, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student285', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student285', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student285', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student285', 'student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student285', 'student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich organization did student285 enlist?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['air_force', 'fire_department']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the air force refers to organ = 'air_force';\nList all students in the air force and which school they were enrolled 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 T1.name, T1.school FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'air_force'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name, T1.school FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'air_force'", "index": 2165, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['air_force', 'fire_department']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the air force refers to organ = 'air_force';\nList all students in the air force and which school they were enrolled 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 bool (\n name text, -- example: ['pos', 'neg']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['pos', 'neg']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith due payments refers to bool = 'pos'; organization refers to organ\nName 5 students with due payments that are enlisted alongside which organization they were enlisted.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.organ, T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.bool = 'pos' LIMIT 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T2.organ, T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.bool = 'pos' LIMIT 5", "index": 2166, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE bool (\n name text, -- example: ['pos', 'neg']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['pos', 'neg']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith due payments refers to bool = 'pos'; organization refers to organ\nName 5 students with due payments that are enlisted alongside which organization they were enlisted.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the navy refers to organ = 'navy'; enrolled in OCC refers to school = 'occ'\nWhat percentage of students who enlisted in the navy make up the number of students enrolled in OCC?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(IIF(T1.school = 'occ', 1.0, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T1.school = 'occ', 1.0, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy'", "index": 2167, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the navy refers to organ = 'navy'; enrolled in OCC refers to school = 'occ'\nWhat percentage of students who enlisted in the navy make up the number of students enrolled in OCC?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the total number of students in the school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM person", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM person", "index": 2168, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the total number of students in the school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the number of unemployed and bankrupt students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name", "index": 2169, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the number of unemployed and bankrupt students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nif student name appear in disabled then student is disabled and vice versa; if student name appear in male then student is male and vice versa\nPlease check if student 124 is disabled male.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT IIF(T2.name IS NULL, 'female', 'male') FROM male AS T1 LEFT JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.name = 'student124'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT IIF(T2.name IS NULL, 'female', 'male') FROM male AS T1 LEFT JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.name = 'student124'", "index": 2170, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nif student name appear in disabled then student is disabled and vice versa; if student name appear in male then student is male and vice versa\nPlease check if student 124 is disabled male.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['air_force', 'marines', 'fire_department']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined a marines refers to organ = 'marines'; air force organization refers to organ = 'air_force';\nHow many female students joined a marines and air force organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ IN ('marines', 'air_force') AND name NOT IN ( SELECT name FROM male )", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ IN ('marines', 'air_force') AND name NOT IN ( SELECT name FROM male )", "index": 2171, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['air_force', 'marines', 'fire_department']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined a marines refers to organ = 'marines'; air force organization refers to organ = 'air_force';\nHow many female students joined a marines and air force organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio refers to DIVIDE(COUNT(name not from male), COUNT(name from male))\nWhat is the ratio of disable female to male students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T2.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T1.`name` = T2.`name`", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T2.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T1.`name` = T2.`name`", "index": 2172, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio refers to DIVIDE(COUNT(name not from male), COUNT(name from male))\nWhat is the ratio of disable female to male students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale students refers to enlist.name who are NOT in male.name\nHow many female students are not joining any of the organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM person WHERE name NOT IN ( SELECT name FROM male ) AND name NOT IN ( SELECT name FROM enrolled )", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM person WHERE name NOT IN ( SELECT name FROM male ) AND name NOT IN ( SELECT name FROM enrolled )", "index": 2173, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale students refers to enlist.name who are NOT in male.name\nHow many female students are not joining any of the organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmake payment before due refers to bool = 'neg';\nList out all bankrupt students that are able to make payment before due?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 filed_for_bankrupcy AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM filed_for_bankrupcy AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg'", "index": 2174, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmake payment before due refers to bool = 'neg';\nList out all bankrupt students that are able to make payment before due?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage refers to DIVIDE(SUM(month), COUNT(name))\nWhat is the average absence period of a student?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(month) FROM longest_absense_from_school", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT AVG(month) FROM longest_absense_from_school", "index": 2175, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage refers to DIVIDE(SUM(month), COUNT(name))\nWhat is the average absence period of a student?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norganization refers to organ\nWhich organization does student 313 belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT organ FROM enlist WHERE name = 'studenT113'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT organ FROM enlist WHERE name = 'studenT113'", "index": 2176, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norganization refers to organ\nWhich organization does student 313 belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent above 2 months refers to month > 2;\nHow many students have been absent above 2 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM longest_absense_from_school WHERE month > 2", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 2", "index": 2177, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent above 2 months refers to month > 2;\nHow many students have been absent above 2 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have payment due refers to bool = 'neg';\nState the number of students do not have payment due.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM no_payment_due WHERE bool = 'neg'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM no_payment_due WHERE bool = 'neg'", "index": 2178, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have payment due refers to bool = 'neg';\nState the number of students do not have payment due.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the navy organization refers to organ = 'navy';\nHow many unemployed students are enlisted in the navy organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'navy'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'navy'", "index": 2179, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['navy', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the navy organization refers to organ = 'navy';\nHow many unemployed students are enlisted in the navy organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['foreign_legion', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to foreign legion refers to organ = 'foreign_legion';\nCount the number of male students who belong to foreign legion.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'foreign_legion'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'foreign_legion'", "index": 2180, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['foreign_legion', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbelong to foreign legion refers to organ = 'foreign_legion';\nCount the number of male students who belong to foreign legion.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['air_force', 'fire_department']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the air force refers to organ = 'air_force';\nList out the number of female students who enlisted in the air force.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ = 'air_force' AND name NOT IN ( SELECT name FROM male )", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ = 'air_force' AND name NOT IN ( SELECT name FROM male )", "index": 2181, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['air_force', 'fire_department']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the air force refers to organ = 'air_force';\nList out the number of female students who enlisted in the air force.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\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 of absense refers to MAX(month)\nState name of disabled students who have the longest duration of absense from school.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name ORDER BY T2.month DESC LIMIT 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name ORDER BY T2.month DESC LIMIT 1", "index": 2182, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\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 of absense refers to MAX(month)\nState name of disabled students who have the longest duration of absense from school.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage refers to DIVIDE(SUM(month), COUNT(name))\nCalculate the average duration of absense of disabled students.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name", "index": 2183, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage refers to DIVIDE(SUM(month), COUNT(name))\nCalculate the average duration of absense of disabled students.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\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 of absense refers to MAX(month)\nState name of unemployed students who have the longest duration of absense from school.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1", "index": 2184, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\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 of absense refers to MAX(month)\nState name of unemployed students who have the longest duration of absense from school.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave never been absent from school refers to month = 0\nMention the name of unemployed students who have never been absent from school.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.month = 0", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.month = 0", "index": 2185, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave never been absent from school refers to month = 0\nMention the name of unemployed students who have never been absent from school.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave been absent for 3 months from school refers to month = 3\nHow many disabled students have been absent for 3 months from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month = 3", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month = 3", "index": 2186, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave been absent for 3 months from school refers to month = 3\nHow many disabled students have been absent for 3 months from school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1000', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student1000', 'student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1000', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1000', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1000', 'student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstudent name appear in Male table means student is a male, student does not appear in Male table means student is a female\nWhat is the gender of student1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT IIF(T.result = 0, 'female', 'male') AS re FROM ( SELECT COUNT(name) AS result FROM male WHERE name = 'studenT1000' ) T", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT IIF(T.result = 0, 'female', 'male') AS re FROM ( SELECT COUNT(name) AS result FROM male WHERE name = 'studenT1000' ) T", "index": 2187, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1000', 'student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student1000', 'student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1000', 'student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1000', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1000', 'student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstudent name appear in Male table means student is a male, student does not appear in Male table means student is a female\nWhat is the gender of student1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['army', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the army refers to organ = 'army';\nHow many students are enlisted in the army?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ = 'army'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ = 'army'", "index": 2188, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['army', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the army refers to organ = 'army';\nHow many students are enlisted in the army?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage refers to DIVIDE(SUM(month), COUNT(name))\nFind the average number of absences for each student.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(month) FROM longest_absense_from_school", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT AVG(month) FROM longest_absense_from_school", "index": 2189, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage refers to DIVIDE(SUM(month), COUNT(name))\nFind the average number of absences for each student.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['foreign_legion', 'peace_corps', 'army', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in foreign legion refers to organ = 'foreign_legion'; peace corps refers to organ = 'peace_corps'; army refers to organ = 'army'\nSum up the number of students enlisted in foreign legion, peace corps and army.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ IN ('army', 'peace_corps', 'foreign_legion')", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ IN ('army', 'peace_corps', 'foreign_legion')", "index": 2190, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['foreign_legion', 'peace_corps', 'army', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in foreign legion refers to organ = 'foreign_legion'; peace corps refers to organ = 'peace_corps'; army refers to organ = 'army'\nSum up the number of students enlisted in foreign legion, peace corps and army.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['pos', 'neg']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['pos', 'neg']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstill have payment due refers to bool = 'pos'\nHow many unemployed students still have payment due?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'pos'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'pos'", "index": 2191, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['pos', 'neg']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['pos', 'neg']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstill have payment due refers to bool = 'pos'\nHow many unemployed students still have payment due?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than one organization refers to COUNT(organ) > 1\nHow many male students join more than one organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T.a) FROM ( SELECT COUNT(DISTINCT T1.name) AS a, COUNT(T2.organ) AS num FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name GROUP BY T1.name ) T WHERE T.num > 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T.a) FROM ( SELECT COUNT(DISTINCT T1.name) AS a, COUNT(T2.organ) AS num FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name GROUP BY T1.name ) T WHERE T.num > 1", "index": 2192, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than one organization refers to COUNT(organ) > 1\nHow many male students join more than one organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['smc', 'occ']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSMC's students refers to school = 'smc'; absent for 7 months refers to month = 7\nHow many SMC's students that absent for 7 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM enrolled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name WHERE T1.school = 'smc' AND T2.month = 7", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM enrolled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name WHERE T1.school = 'smc' AND T2.month = 7", "index": 2193, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['smc', 'occ']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSMC's students refers to school = 'smc'; absent for 7 months refers to month = 7\nHow many SMC's students that absent for 7 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage refers to DIVIDE(COUNT(organ = 'fire_department'), COUNT(name))\nFind the percentage of male students enlisted in the fire department.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name WHERE T1.organ = 'fire_department'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name WHERE T1.organ = 'fire_department'", "index": 2194, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage refers to DIVIDE(COUNT(organ = 'fire_department'), COUNT(name))\nFind the percentage of male students enlisted in the fire department.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsense from school for 5 month refers to month = 5\nHow many students has the longest absense from school for 5 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM longest_absense_from_school WHERE month = 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 5", "index": 2195, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsense from school for 5 month refers to month = 5\nHow many students has the longest absense from school for 5 months?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['army', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the army refers to organ = 'army';\nHow many students are enlisted in the Army organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ = 'army'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ = 'army'", "index": 2196, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['army', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the army refers to organ = 'army';\nHow many students are enlisted in the Army organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['ucla', 'occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenrolled in UCLA refers to school = 'ucla';\nHow many students are enrolled in UCLA school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enrolled WHERE school = 'ucla'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enrolled WHERE school = 'ucla'", "index": 2197, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['ucla', 'occ', 'smc']\n `month` integer, -- example: [1, 2]\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenrolled in UCLA refers to school = 'ucla';\nHow many students are enrolled in UCLA school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined two organization refers to COUNT(organ) > = 2\nHow many of the students joined two organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM enlist WHERE organ >= 2", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM enlist WHERE organ >= 2", "index": 2198, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n `month` integer, -- example: [0, 1]\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined two organization refers to COUNT(organ) > = 2\nHow many of the students joined two organization?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['ucsd', 'occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['peace_corps', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the Peace Corps refers to organ = 'peace_corps'; enrolled in UCSD school refers to school = 'ucsd';\nHow many students are enlisted in the Peace Corps organization are enrolled in UCSD school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name) FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name WHERE T1.organ = 'peace_corps' AND T2.school = 'ucsd'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name WHERE T1.organ = 'peace_corps' AND T2.school = 'ucsd'", "index": 2199, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['ucsd', 'occ', 'smc']\n PRIMARY KEY (name, school),\n CONSTRAINT fk_enrolled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student1', 'student10']\n bool text, -- example: ['neg', 'pos']\n PRIMARY KEY (name),\n CONSTRAINT fk_no_payment_due_name FOREIGN KEY (name) REFERENCES person (name),\n CONSTRAINT fk_no_payment_due_bool FOREIGN KEY (bool) REFERENCES bool (name)\n);\n\nCREATE TABLE bool (\n name text, -- example: ['neg', 'pos']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE unemployed (\n name text, -- example: ['student1000', 'student102']\n PRIMARY KEY (name),\n CONSTRAINT fk_unemployed_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE filed_for_bankrupcy (\n name text, -- example: ['student122', 'student126']\n PRIMARY KEY (name),\n CONSTRAINT fk_filed_for_bankrupcy_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['peace_corps', 'fire_department', 'air_force']\n CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE disabled (\n name text, -- example: ['student114', 'student125']\n PRIMARY KEY (name),\n CONSTRAINT fk_disabled_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student1', 'student10']\n PRIMARY KEY (name),\n CONSTRAINT fk_longest_absense_from_school_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE male (\n name text, -- example: ['student1', 'student101']\n PRIMARY KEY (name),\n CONSTRAINT fk_male_name FOREIGN KEY (name) REFERENCES person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nenlisted in the Peace Corps refers to organ = 'peace_corps'; enrolled in UCSD school refers to school = 'ucsd';\nHow many students are enlisted in the Peace Corps organization are enrolled in UCSD school?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }