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 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 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 `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 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 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:\nnever been absent refers to month = 0;\nHow many unemployed students have never 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 COUNT(T2.name) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.month = 0", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T2.name) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.month = 0", "index": 2200, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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:\nnever been absent refers to month = 0;\nHow many unemployed students have never 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: ['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 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 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 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:\nno payment due refers to bool = 'neg'; organization refers to organ; organ = 'fire_department';\nList at least 10 students who have no payment due and are enlisted in Fire Department 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 T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.bool = 'neg' AND T2.organ = 'fire_department' LIMIT 10", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.bool = 'neg' AND T2.organ = 'fire_department' LIMIT 10", "index": 2201, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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:\nno payment due refers to bool = 'neg'; organization refers to organ; organ = 'fire_department';\nList at least 10 students who have no payment due and are enlisted in Fire Department 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 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 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);\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 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 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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave payment due refers to bool = 'pos';\nHow many disabled students 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 disabled AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T2.bool = 'pos'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM disabled AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T2.bool = 'pos'", "index": 2202, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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);\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 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 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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave payment due refers to bool = 'pos';\nHow many disabled students 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 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);\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 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 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 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 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:\naverage = DIVIDE(COUNT(disabled.name who are not in male.name WHERE organ = 'foreign_legion'), COUNT(disabled.name)); female students who are disabled refers to disabled.name who are NOT in male.name; organization refers to organ; organ = 'Foreign Legion';\nCalculate the average number of female students who are disabled and who joined Foreign Legion 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 CAST(SUM(IIF(T3.name IS NULL, 1, 0)) AS REAL) / COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T2.organ = 'foreign_legion'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T3.name IS NULL, 1, 0)) AS REAL) / COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T2.organ = 'foreign_legion'", "index": 2203, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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:\naverage = DIVIDE(COUNT(disabled.name who are not in male.name WHERE organ = 'foreign_legion'), COUNT(disabled.name)); female students who are disabled refers to disabled.name who are NOT in male.name; organization refers to organ; organ = 'Foreign Legion';\nCalculate the average number of female students who are disabled and who joined Foreign Legion 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is NOT in male.name), COUNT(enlist.name WHERE organ = 'fire_department),'%'))) AS FEMALE; ratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is IN male.name), COUNT(enlist.name WHERE organ = 'fire_department), 100))) AS MALE; female students refers to enlist.name who are NOT in male.name; male students refers to enlist.name who are IN male.name; organization refers to organ; organ = 'fire_department';\nCalculate the ratio in percentage between the average number of female and male students who joined Fire Department 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 CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name), CAST(SUM(IIF(T2.name IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.organ = 'fire_department'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name), CAST(SUM(IIF(T2.name IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.organ = 'fire_department'", "index": 2204, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is NOT in male.name), COUNT(enlist.name WHERE organ = 'fire_department),'%'))) AS FEMALE; ratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is IN male.name), COUNT(enlist.name WHERE organ = 'fire_department), 100))) AS MALE; female students refers to enlist.name who are NOT in male.name; male students refers to enlist.name who are IN male.name; organization refers to organ; organ = 'fire_department';\nCalculate the ratio in percentage between the average number of female and male students who joined Fire Department 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 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 `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 organ text, -- organization, example: ['navy', '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 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:\nnavy refers to organ = 'navy';\nHow many students enlisted in the navy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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": 2205, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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 organ text, -- organization, example: ['navy', '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 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:\nnavy refers to organ = 'navy';\nHow many students enlisted in the navy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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 `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 =  DIVIDE(COUNT(name WHERE `bool` = 'pos'), COUNT(name WHERE `bool` = 'neg')); have payment due refers to `bool` = 'pos'; no payment due refers to `bool` = 'neg';\nWhat is the ratio of students who have payment due and those who 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 CAST(SUM(IIF(`bool` = 'pos', 1, 0)) AS REAL) / SUM(IIF(`bool` = 'neg', 1, 0)) FROM no_payment_due", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(`bool` = 'pos', 1, 0)) AS REAL) / SUM(IIF(`bool` = 'neg', 1, 0)) FROM no_payment_due", "index": 2206, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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 `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 =  DIVIDE(COUNT(name WHERE `bool` = 'pos'), COUNT(name WHERE `bool` = 'neg')); have payment due refers to `bool` = 'pos'; no payment due refers to `bool` = 'neg';\nWhat is the ratio of students who have payment due and those who 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 `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 organ text, -- organization, example: ['air_force', '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 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 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 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:\nfemale students refers to enlist.name who are NOT in male.name; air force refers to organ = 'air_force';\nList any five female students' names who enlisted for 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 T1.name FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T2.name IS NULL AND T1.organ = 'air_force' LIMIT 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T2.name IS NULL AND T1.organ = 'air_force' LIMIT 5", "index": 2207, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nfemale students refers to enlist.name who are NOT in male.name; air force refers to organ = 'air_force';\nList any five female students' names who enlisted for 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 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 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 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 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 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:\nstudents who are not disabled refers to person.name who are NOT in disabled.name;\nCalculate the number of students who are not disabled.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(CASE WHEN T2.name IS NULL THEN T1.name END) AS \"number\" FROM person AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(CASE WHEN T2.name IS NULL THEN T1.name END) AS \"number\" FROM person AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name", "index": 2208, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 `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 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:\nstudents who are not disabled refers to person.name who are NOT in disabled.name;\nCalculate the number of students who are not disabled.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 person (\n name text, -- example: ['student995', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student995', '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 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 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: ['student995', '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: ['student995', '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:\nmale.name = 'student995' means student995's gender is male; if 'student995' can not be found in 'male.name', it means student995 is female;\nDefine the gender of \"student995\" and his/her enrolled schools.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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') AS gen , T1.school FROM enrolled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.name = 'student995'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT IIF(T2.name IS NULL, 'female', 'male') AS gen , T1.school FROM enrolled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.name = 'student995'", "index": 2209, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 person (\n name text, -- example: ['student995', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE no_payment_due (\n name text, -- example: ['student995', '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 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 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: ['student995', '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: ['student995', '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:\nmale.name = 'student995' means student995's gender is male; if 'student995' can not be found in 'male.name', it means student995 is female;\nDefine the gender of \"student995\" and his/her enrolled schools.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nstudents with disabilities who are unemployed refers to disabled.name who are IN unemployed.name;\nAmong the students with disabilities, list any five students' names who are unemployed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 unemployed AS T2 ON T2.name = T1.name LIMIT 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM disabled AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name LIMIT 5", "index": 2210, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nstudents with disabilities who are unemployed refers to disabled.name who are IN unemployed.name;\nAmong the students with disabilities, list any five students' names who are unemployed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 `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 for four months refers to month = 4; enlisted organizations refers to organ;\nAmong the students who have been absent for four months, provide any five students' names and enlisted organizations.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.name, T2.organ FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.month = 4 LIMIT 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T2.name, T2.organ FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.month = 4 LIMIT 5", "index": 2211, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 `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 for four months refers to month = 4; enlisted organizations refers to organ;\nAmong the students who have been absent for four months, provide any five students' names and enlisted organizations.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['student160', '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 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: ['student160', '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 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 no_payment_due (\n name text, -- example: ['student160', '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: ['student160', 'student1', 'student10']\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: ['student160', '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 organizations refers to organ; student160 is a name of student; status of his or her payment due is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due;\nProvide the enlisted organizations of student160 and status of his/her 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 T1.organ, T2.bool FROM enlist AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T1.name = 'student160'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.organ, T2.bool FROM enlist AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T1.name = 'student160'", "index": 2212, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['student160', '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 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: ['student160', '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 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 no_payment_due (\n name text, -- example: ['student160', '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: ['student160', 'student1', 'student10']\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: ['student160', '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 organizations refers to organ; student160 is a name of student; status of his or her payment due is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due;\nProvide the enlisted organizations of student160 and status of his/her 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = CONCAT(DIVIDE(MULTIPLY(COUNT(person.name which is not in male.name)), 100), COUNT(person.name that is IN male.name),'%'); female students refers to person.name who are NOT in male.name;\nCalculate the percentage of female 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(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name", "index": 2213, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = CONCAT(DIVIDE(MULTIPLY(COUNT(person.name which is not in male.name)), 100), COUNT(person.name that is IN male.name),'%'); female students refers to person.name who are NOT in male.name;\nCalculate the percentage of female 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 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);\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: ['fire_department', 'air_force']\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 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 `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:\nHow many students are filed for bankruptcy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 filed_for_bankrupcy", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM filed_for_bankrupcy", "index": 2214, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 `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:\nHow many students are filed for bankruptcy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\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; disabled male students refers to disabled.name who are IN male.name;\nHow many disabled male students joined an 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 disabled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name INNER JOIN enlist AS T3 ON T3.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name INNER JOIN enlist AS T3 ON T3.name = T2.name", "index": 2215, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\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; disabled male students refers to disabled.name who are IN male.name;\nHow many disabled male students joined an 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: ['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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngender breakdown refers to the number of male and female; male are mentioned in male.name; female refers to enlist.name who are NOT in male.name; organization refers to organ;\nPlease provide a gender breakdown for each 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 IIF(T2.name IS NULL, 'female', 'male') AS gender FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name GROUP BY T1.organ", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT IIF(T2.name IS NULL, 'female', 'male') AS gender FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name GROUP BY T1.organ", "index": 2216, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngender breakdown refers to the number of male and female; male are mentioned in male.name; female refers to enlist.name who are NOT in male.name; organization refers to organ;\nPlease provide a gender breakdown for each 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 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 `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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage difference = CONCAT(DIVIDE(MULTIPLY(SUBTRACT(COUNT(name WHERE month = 0), COUNT(name WHERE month = 9)), 100), COUNT(name WHERE month = 0)),'%');\nWhat is the percentage difference between month 0 absence and month 9 absence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(month = 0, 1, 0)) - SUM(IIF(month = 9, 1, 0)))) AS REAL) * 100 / SUM(IIF(month = 0, 1, 0)) FROM longest_absense_from_school", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(((SUM(IIF(month = 0, 1, 0)) - SUM(IIF(month = 9, 1, 0)))) AS REAL) * 100 / SUM(IIF(month = 0, 1, 0)) FROM longest_absense_from_school", "index": 2217, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage difference = CONCAT(DIVIDE(MULTIPLY(SUBTRACT(COUNT(name WHERE month = 0), COUNT(name WHERE month = 9)), 100), COUNT(name WHERE month = 0)),'%');\nWhat is the percentage difference between month 0 absence and month 9 absence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale students are mentioned in male.name; unemployed and disabled refers to unemployed.name = disabled.name; absent for 5 month refers to month = 5;\nWhich male students are unemployed, disable and were absent for 5 month?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 unemployed AS T1 INNER JOIN disabled AS T2 ON T2.name = T1.name INNER JOIN longest_absense_from_school AS T3 ON T3.name = T2.name WHERE T3.month = 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM unemployed AS T1 INNER JOIN disabled AS T2 ON T2.name = T1.name INNER JOIN longest_absense_from_school AS T3 ON T3.name = T2.name WHERE T3.month = 5", "index": 2218, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale students are mentioned in male.name; unemployed and disabled refers to unemployed.name = disabled.name; absent for 5 month refers to month = 5;\nWhich male students are unemployed, disable and were absent for 5 month?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nfemale students refers to enrolled.name who are NOT in male.name; occ school and ulca refers to school IN('occ', 'ulca');\nList out female students that enrolled in occ school and ulca?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 enrolled WHERE school IN ('occ', 'ulca') AND name NOT IN ( SELECT name FROM male )", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT name FROM enrolled WHERE school IN ('occ', 'ulca') AND name NOT IN ( SELECT name FROM male )", "index": 2219, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nfemale students refers to enrolled.name who are NOT in male.name; occ school and ulca refers to school IN('occ', 'ulca');\nList out female students that enrolled in occ school and ulca?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE(SUM(month), COUNT(unemployed.name who are in male.name)); unemployed male students refers to unemployed.name who are IN male.name;\nWhat is the average absent month for a unemployed 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 AVG(T2.month) AS avg FROM unemployed AS T1 INNER JOIN longest_absense_from_school AS T2 ON T2.name = T1.name INNER JOIN male AS T3 ON T3.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT AVG(T2.month) AS avg FROM unemployed AS T1 INNER JOIN longest_absense_from_school AS T2 ON T2.name = T1.name INNER JOIN male AS T3 ON T3.name = T2.name", "index": 2220, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE(SUM(month), COUNT(unemployed.name who are in male.name)); unemployed male students refers to unemployed.name who are IN male.name;\nWhat is the average absent month for a unemployed 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 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 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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference = MULTIPLY(DIVIDE(SUBTRACT(COUNT(longest_absense_from_school.name that is in disabled.name), COUNT(longest _absense_from_school.name that is NOT in disabled.name), longest _absense_from_school.name), 100)); IF COUNT(longest_absense_from_school.name that is in disabled.name) < COUNT(longest _absense_from_school.name that is NOT in disabled.name), it means, the disabled students have better attendance than non-disabled students; IF COUNT(longest_absense_from_school.name that is in disabled.name) > COUNT(longest _absense_from_school.name that is NOT in disabled.name), it means the disabled students do not have a better attendance than non-disabled students;\nWhat is the percentage difference between the attendence of disabled and non-disable students? Do the disable students show better attendance than non-disable 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 NOT NULL AND T1.month = 0, 1, 0)) - SUM(IIF(T2.name IS NULL AND T1.month = 0, 1, 0))) AS REAL) * 100 / COUNT(T1.name), IIF(SUM(IIF(T2.name IS NOT NULL AND T1.month = 0, 1, 0)) - SUM(IIF(T2.name IS NULL AND T1.month = 0, 1, 0)) > 0, 'YES', 'NO') AS isHigh FROM longest_absense_from_school AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST((SUM(IIF(T2.name IS NOT NULL AND T1.month = 0, 1, 0)) - SUM(IIF(T2.name IS NULL AND T1.month = 0, 1, 0))) AS REAL) * 100 / COUNT(T1.name), IIF(SUM(IIF(T2.name IS NOT NULL AND T1.month = 0, 1, 0)) - SUM(IIF(T2.name IS NULL AND T1.month = 0, 1, 0)) > 0, 'YES', 'NO') AS isHigh FROM longest_absense_from_school AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name", "index": 2221, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference = MULTIPLY(DIVIDE(SUBTRACT(COUNT(longest_absense_from_school.name that is in disabled.name), COUNT(longest _absense_from_school.name that is NOT in disabled.name), longest _absense_from_school.name), 100)); IF COUNT(longest_absense_from_school.name that is in disabled.name) < COUNT(longest _absense_from_school.name that is NOT in disabled.name), it means, the disabled students have better attendance than non-disabled students; IF COUNT(longest_absense_from_school.name that is in disabled.name) > COUNT(longest _absense_from_school.name that is NOT in disabled.name), it means the disabled students do not have a better attendance than non-disabled students;\nWhat is the percentage difference between the attendence of disabled and non-disable students? Do the disable students show better attendance than non-disable 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 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 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 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: ['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);\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 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:\naverage duration = DIVIDE(SUM(month), COUNT(month)); duration of absence refers to month; disabled male students refers to disabled.name who are IN male.name;\nCalculate the average duration of absense of disabled 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 AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T2.name = T1.name INNER JOIN male AS T3 ON T3.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 T2.name = T1.name INNER JOIN male AS T3 ON T3.name = T2.name", "index": 2222, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['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);\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 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:\naverage duration = DIVIDE(SUM(month), COUNT(month)); duration of absence refers to month; disabled male students refers to disabled.name who are IN male.name;\nCalculate the average duration of absense of disabled 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 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 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 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 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);\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 male students who 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(T1.name) FROM no_payment_due AS T1 INNER JOIN male AS T2 ON T2.name = T1.name WHERE T1.bool = 'pos'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN male AS T2 ON T2.name = T1.name WHERE T1.bool = 'pos'", "index": 2223, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\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 male students who 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 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 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: ['student124', '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 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: ['student124', '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: ['student124', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student124', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstatus of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student124 is a name of student;\nWhat is the status of payment of student 124?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT `bool` FROM no_payment_due WHERE name = 'student124'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT `bool` FROM no_payment_due WHERE name = 'student124'", "index": 2224, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['student124', '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 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: ['student124', '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: ['student124', 'student1', 'student10']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE longest_absense_from_school (\n name text, -- example: ['student124', '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 `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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstatus of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student124 is a name of student;\nWhat is the status of payment of student 124?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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:\nabsent for 5 months refers to month = 5; do not have payment due refers to bool = 'neg';\nState name of students who have been absent for 5 months from school and 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 T1.name FROM longest_absense_from_school AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T1.month = 5 AND T2.bool = 'neg'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T1.month = 5 AND T2.bool = 'neg'", "index": 2225, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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:\nabsent for 5 months refers to month = 5; do not have payment due refers to bool = 'neg';\nState name of students who have been absent for 5 months from school and 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 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 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 `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);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['marines', '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 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:\nmarines refers to organ = 'marines';\nList out the number of disabled students who enlisted in marines.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'", "index": 2226, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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);\n\nCREATE TABLE enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['marines', '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 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:\nmarines refers to organ = 'marines';\nList out the number of disabled students who enlisted in marines.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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:\nnavy refers to organ = 'navy';\nList out the number of students who filed for bankruptcy and enlisted in navy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 filed_for_bankrupcy AS T2 ON T1.name = T2.name WHERE T1.organ = 'navy'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name WHERE T1.organ = 'navy'", "index": 2227, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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:\nnavy refers to organ = 'navy';\nList out the number of students who filed for bankruptcy and enlisted in navy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['marines', '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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarines refers to organ = 'marines'; have payment due refers to bool = 'pos';\nGive the number of students who enlisted in marines 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 no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos' AND T2.organ = 'marines'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos' AND T2.organ = 'marines'", "index": 2228, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['marines', '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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarines refers to organ = 'marines'; have payment due refers to bool = 'pos';\nGive the number of students who enlisted in marines 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 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 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 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);\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 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 = MULTIPLY(DIVIDE(SUM(month = 0), COUNT(disabled.name)), 100); never been absent from school refers to month = 0;\nCalculate the ratio of disabled 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 100 * SUM(IIF(T2.month = 0, 1, 0)) AS num FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT 100 * SUM(IIF(T2.month = 0, 1, 0)) AS num FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name", "index": 2229, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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);\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 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 = MULTIPLY(DIVIDE(SUM(month = 0), COUNT(disabled.name)), 100); never been absent from school refers to month = 0;\nCalculate the ratio of disabled 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 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);\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 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 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 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:\naverage duration = DIVIDE(SUM(month), COUNT(longest_absence_from_school.name which are NOT in male.name)); female students refers to longest_absence_from_school.name who are NOT in male.name;\nCalculate the average duration of absense of female 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(T2.month) FROM person AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T1.name = T3.name WHERE T3.name IS NULL", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT AVG(T2.month) FROM person AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T1.name = T3.name WHERE T3.name IS NULL", "index": 2230, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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 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 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 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:\naverage duration = DIVIDE(SUM(month), COUNT(longest_absence_from_school.name which are NOT in male.name)); female students refers to longest_absence_from_school.name who are NOT in male.name;\nCalculate the average duration of absense of female 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 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 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: ['student299', '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 enrolled (\n name text, -- example: ['student299', '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: ['student299', '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 person (\n name text, -- example: ['student299', '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:\nstatus of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student299 is a name of student;\nMention the status of payment of student 299.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT bool FROM no_payment_due WHERE name = 'student299'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT bool FROM no_payment_due WHERE name = 'student299'", "index": 2231, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['student299', '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 enrolled (\n name text, -- example: ['student299', '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: ['student299', '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 person (\n name text, -- example: ['student299', '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:\nstatus of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student299 is a name of student;\nMention the status of payment of student 299.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 `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:\nhave absent from school refers to month > 1;\nHow many students have 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(name) FROM longest_absense_from_school WHERE month > 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 1", "index": 2232, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 `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:\nhave absent from school refers to month > 1;\nHow many students have 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 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: ['pos', 'neg']\n PRIMARY KEY (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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npayment due refers to bool = 'pos';\nHow many disabled students 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 no_payment_due AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos'", "index": 2233, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 bool (\n name text, -- example: ['pos', 'neg']\n PRIMARY KEY (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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npayment due refers to bool = 'pos';\nHow many disabled students 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOCC refers to school = 'occ';\nAmong the students that filed for bankruptcy, how many of them have been 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 COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name WHERE T2.school = 'occ'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name WHERE T2.school = 'occ'", "index": 2234, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOCC refers to school = 'occ';\nAmong the students that filed for bankruptcy, how many of them have been 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale students are mentioned in male.name;\nHow many disabled students 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 male AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM male AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name", "index": 2235, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['fire_department', 'air_force']\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 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);\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 `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:\nmale students are mentioned in male.name;\nHow many disabled students 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: ['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);\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 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 bool (\n name text, -- example: ['pos', 'neg']\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 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:\nmale students are mentioned in male.name; with payment due refers to bool = 'pos';\nAmong the male students, list down the names of students with 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 T1.name FROM male 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 T1.name FROM male AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'pos'", "index": 2236, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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);\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 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 bool (\n name text, -- example: ['pos', 'neg']\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 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:\nmale students are mentioned in male.name; with payment due refers to bool = 'pos';\nAmong the male students, list down the names of students with 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 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 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 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 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 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:\npercentage = MULTIPLY(DIVIDE(COUNT(male.name), COUNT(person.name)), 100); male students are mentioned in male.name;\nAmong all students, calculate the percentage of 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(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name", "index": 2237, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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:\npercentage = MULTIPLY(DIVIDE(COUNT(male.name), COUNT(person.name)), 100); male students are mentioned in male.name;\nAmong all students, calculate the percentage of 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 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 CONSTRAINT fk_enlist_name FOREIGN KEY (name) REFERENCES person (name)\n);\n\nCREATE TABLE person (\n name text, -- example: ['student34', '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 enrolled (\n name text, -- example: ['student34', '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: ['student34', '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 no_payment_due (\n name text, -- example: ['student34', '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 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:\nmale.name = 'student34' means student34's gender is male; if 'student34' can't be found in 'male.name', it means student34 is female; student34 is a name of student;\nWhat is the school and gender of student34?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.school , IIF(T3.name IS NULL, 'female', 'male') AS gender FROM enrolled AS T1 INNER JOIN person AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T2.name = 'student34'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.school , IIF(T3.name IS NULL, 'female', 'male') AS gender FROM enrolled AS T1 INNER JOIN person AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T2.name = 'student34'", "index": 2238, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['student34', '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 enrolled (\n name text, -- example: ['student34', '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: ['student34', '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 no_payment_due (\n name text, -- example: ['student34', '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 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:\nmale.name = 'student34' means student34's gender is male; if 'student34' can't be found in 'male.name', it means student34 is female; student34 is a name of student;\nWhat is the school and gender of student34?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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:\n1 month of absences refers to month = 1; department refers to organ; organ = 'air_force';\nAmong students with 1 month of absenses, how many of them are enlisted in the air force 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(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T1.month = 1 AND T2.organ = 'air_force'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T1.month = 1 AND T2.organ = 'air_force'", "index": 2239, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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:\n1 month of absences refers to month = 1; department refers to organ; organ = 'air_force';\nAmong students with 1 month of absenses, how many of them are enlisted in the air force 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndisabled male students that are unemployed refers to unemployed.name = male.name = disabled.name;\nProvide the name of disabled male students that are unemployed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.NAME FROM unemployed AS T1 INNER JOIN male AS T2 ON T1.name = T2.name INNER JOIN disabled AS T3 ON T3.name = T2.name", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T2.NAME FROM unemployed AS T1 INNER JOIN male AS T2 ON T1.name = T2.name INNER JOIN disabled AS T3 ON T3.name = T2.name", "index": 2240, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndisabled male students that are unemployed refers to unemployed.name = male.name = disabled.name;\nProvide the name of disabled male students that are unemployed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale students are mentioned in male.name; OCC refers to school = 'occ';\nHow many male students are enrolled at 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 COUNT(T1.name) FROM enrolled AS T1 INNER JOIN male AS T2 ON T1.name = T2.name WHERE T1.school = 'occ'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM enrolled AS T1 INNER JOIN male AS T2 ON T1.name = T2.name WHERE T1.school = 'occ'", "index": 2241, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale students are mentioned in male.name; OCC refers to school = 'occ';\nHow many male students are enrolled at 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 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 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 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 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 enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['ucla', '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:\nUCLA refers to school = 'ucla'; percentage = MULTIPLY(DIVIDE(COUNT(male.name), COUNT(person.name)), 100); male students are mentioned in male.name; department refers to organ; organ = 'air_force';\nAmong the students enrolled in UCLA, what is the percentage of male students in the air force 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(T4.name) AS REAL) * 100 / COUNT(T2.name) FROM enlist AS T1 INNER JOIN person AS T2 ON T1.name = T2.name INNER JOIN enrolled AS T3 ON T3.name = T2.name LEFT JOIN male AS T4 ON T2.name = T4.name WHERE T3.school = 'ucla' AND T1.organ = 'air_force'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT CAST(COUNT(T4.name) AS REAL) * 100 / COUNT(T2.name) FROM enlist AS T1 INNER JOIN person AS T2 ON T1.name = T2.name INNER JOIN enrolled AS T3 ON T3.name = T2.name LEFT JOIN male AS T4 ON T2.name = T4.name WHERE T3.school = 'ucla' AND T1.organ = 'air_force'", "index": 2242, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 enrolled (\n name text, -- example: ['student1', 'student10']\n school text, -- example: ['ucla', '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:\nUCLA refers to school = 'ucla'; percentage = MULTIPLY(DIVIDE(COUNT(male.name), COUNT(person.name)), 100); male students are mentioned in male.name; department refers to organ; organ = 'air_force';\nAmong the students enrolled in UCLA, what is the percentage of male students in the air force 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 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 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 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 `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 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);\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 in school refers to month = 0;\nHow many students have never been absent in 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 longest_absense_from_school WHERE month = 0", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 0", "index": 2243, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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);\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 in school refers to month = 0;\nHow many students have never been absent in 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: ['marines', '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 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 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 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 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:\nMarines refers to organ = 'marines';\nWhat are the names of the students who joined the Marines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 = 'marines'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT name FROM enlist WHERE organ = 'marines'", "index": 2244, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['marines', '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 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 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 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 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:\nMarines refers to organ = 'marines';\nWhat are the names of the students who joined the Marines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nlongest duration of absence refers to MAX(month);\nWhat is the name of the student with the longest duration of absence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 = ( SELECT MAX(month) FROM longest_absense_from_school )", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT name FROM longest_absense_from_school WHERE month = ( SELECT MAX(month) FROM longest_absense_from_school )", "index": 2245, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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:\nlongest duration of absence refers to MAX(month);\nWhat is the name of the student with the longest duration of absence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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 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 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:\nname of the organization refers to organ; organization which most of the students are enlisted in refers to MAX(COUNT(organ));\nWhat is the name of the organization which most of the students are enlisted 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 organ FROM ( SELECT organ, COUNT(organ) AS num FROM enlist GROUP BY organ ) T ORDER BY T.num DESC LIMIT 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT organ FROM ( SELECT organ, COUNT(organ) AS num FROM enlist GROUP BY organ ) T ORDER BY T.num DESC LIMIT 1", "index": 2246, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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 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 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:\nname of the organization refers to organ; organization which most of the students are enlisted in refers to MAX(COUNT(organ));\nWhat is the name of the organization which most of the students are enlisted 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 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: ['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);\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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many of the unemployed students are disabled?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 disabled 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 disabled AS T2 ON T1.name = T2.name", "index": 2247, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many of the unemployed students are disabled?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent for more than 5 months refers to month > 5;\nList the names of the disabled students who were absent from school for more than 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 T1.name FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month > 5", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month > 5", "index": 2248, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabsent for more than 5 months refers to month > 5;\nList the names of the disabled students who were absent from school for more than 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 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 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 enlist (\n name text, -- example: ['student40', 'student51']\n organ text, -- organization, example: ['marines', '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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMarines refers to organ = 'marines';\nHow many bankrupt students are there in the Marines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'", "index": 2249, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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: ['marines', '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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMarines refers to organ = 'marines';\nHow many bankrupt students are there in the Marines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAir Force refers to organ = 'air_force'; number of months a student miss school the most refers to MAX(COUNT(month));\nHow many months did a student in the Air Force miss school the most?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.month FROM longest_absense_from_school AS T1 INNER JOIN enlist 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.month FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1", "index": 2250, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAir Force refers to organ = 'air_force'; number of months a student miss school the most refers to MAX(COUNT(month));\nHow many months did a student in the Air Force miss school the most?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 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 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:\nemployed students refers to disabled.name who are NOT in unemployed.name; zero absences refers to month = 0;\nHow many employed disabled students have zero absences?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 INNER JOIN unemployed AS T3 ON T3.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 INNER JOIN unemployed AS T3 ON T3.name = T2.name WHERE T1.month = 0", "index": 2251, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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);\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 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 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:\nemployed students refers to disabled.name who are NOT in unemployed.name; zero absences refers to month = 0;\nHow many employed disabled students have zero absences?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 `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);\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; highest number of male students refers to MAX(COUNT(male.name)); percentage = DIVIDE(COUNT(male.name), COUNT(person.name)), 1.0;\nWhich organization has the highest number of male students? Calculate for the percentage of the male students in the said 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 T.organ, T.per FROM ( SELECT T1.organ, CAST(COUNT(T3.name) AS REAL) / COUNT(T2.name) AS per , COUNT(T3.name) AS num FROM enlist AS T1 INNER JOIN person AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name GROUP BY T1.organ ) T ORDER BY T.num DESC LIMIT 1", "style": "rule" }
{ "db_id": "student_loan.sqlite", "gt_sql": "SELECT T.organ, T.per FROM ( SELECT T1.organ, CAST(COUNT(T3.name) AS REAL) / COUNT(T2.name) AS per , COUNT(T3.name) AS num FROM enlist AS T1 INNER JOIN person AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name GROUP BY T1.organ ) T ORDER BY T.num DESC LIMIT 1", "index": 2252, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 `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);\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; highest number of male students refers to MAX(COUNT(male.name)); percentage = DIVIDE(COUNT(male.name), COUNT(person.name)), 1.0;\nWhich organization has the highest number of male students? Calculate for the percentage of the male students in the said 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 Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrom 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; Question 13 refer to QuestionID\nFrom 2016 to 2019, how many users each year were asked the question 13?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SurveyID, COUNT(UserID) FROM Answer WHERE QuestionID = 13 AND SurveyID BETWEEN 2016 AND 2019 GROUP BY SurveyID", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT SurveyID, COUNT(UserID) FROM Answer WHERE QuestionID = 13 AND SurveyID BETWEEN 2016 AND 2019 GROUP BY SurveyID", "index": 2253, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrom 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; Question 13 refer to QuestionID\nFrom 2016 to 2019, how many users each year were asked the question 13?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAge 27 to 35 refer to AnswerText 27 BETWEEN 35 where questionid = 1; 2018 refer to SurveyID\n\n\nHow many users, between the age 27 to 35, were surveyed in 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2018 AND T2.questionid = 1 AND T1.AnswerText BETWEEN '27' AND '35'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2018 AND T2.questionid = 1 AND T1.AnswerText BETWEEN '27' AND '35'", "index": 2254, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAge 27 to 35 refer to AnswerText 27 BETWEEN 35 where questionid = 1; 2018 refer to SurveyID\n\n\nHow many users, between the age 27 to 35, were surveyed in 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['People', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBetween 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; People with mental illness refers to AnswerText = 'Yes' where questionid = 34\nBetweeen 2016 to 2019, which year recorded the highest number of people with mental illness?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SurveyID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID BETWEEN 2016 AND 2019 AND T2.questionid = 34 AND T1.AnswerText LIKE 'Yes' GROUP BY T1.SurveyID ORDER BY COUNT(T1.UserID) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT T1.SurveyID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID BETWEEN 2016 AND 2019 AND T2.questionid = 34 AND T1.AnswerText LIKE 'Yes' GROUP BY T1.SurveyID ORDER BY COUNT(T1.UserID) DESC LIMIT 1", "index": 2255, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['People', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBetween 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; People with mental illness refers to AnswerText = 'Yes' where questionid = 34\nBetweeen 2016 to 2019, which year recorded the highest number of people with mental illness?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Nebraska', 'female', 'Female', 'Yes', '37']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2017', 'mental health survey for 2019', 'mental health survey for 2018', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAnswerText = 'Yes' where questiontext = 'Do you have a family history of mental illness?'; AnswerText = 'Female' where questionid = 2; AnswerText = 'Nebraska' where questionid = 4\nHow many female users were surveyed in the mental health survey for 2017 in the state of Nebraska?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM ( SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T3.Description = 'mental health survey for 2017' AND T1.questionid = 2 AND T2.AnswerText = 'Female' UNION SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T1.questionid = 4 AND T2.AnswerText = 'Nebraska' AND T3.Description = 'mental health survey for 2017' )", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(*) FROM ( SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T3.Description = 'mental health survey for 2017' AND T1.questionid = 2 AND T2.AnswerText = 'Female' UNION SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T1.questionid = 4 AND T2.AnswerText = 'Nebraska' AND T3.Description = 'mental health survey for 2017' )", "index": 2256, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Nebraska', 'female', 'Female', 'Yes', '37']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2017', 'mental health survey for 2019', 'mental health survey for 2018', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAnswerText = 'Yes' where questiontext = 'Do you have a family history of mental illness?'; AnswerText = 'Female' where questionid = 2; AnswerText = 'Nebraska' where questionid = 4\nHow many female users were surveyed in the mental health survey for 2017 in the state of Nebraska?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', 'productive', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUsers who believed that their productivity is affected by a mental health issues overall refers to AnswerText = 'Yes' where questionid = 54\nHow many users believed that their productivity is ever affected by a mental health issue overall?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 54 AND T1.AnswerText LIKE 'Yes'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 54 AND T1.AnswerText LIKE 'Yes'", "index": 2257, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', 'productive', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUsers who believed that their productivity is affected by a mental health issues overall refers to AnswerText = 'Yes' where questionid = 54\nHow many users believed that their productivity is ever affected by a mental health issue overall?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOldest user refer to MAX(AnswerText) where questionid = 1; Youngest user refer to MIN(AnswerText) where questionid = 1\n\nWhat are the ages of the oldest and youngest user that were surveyed? Indicate their user id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT MAX(T1.AnswerText), MIN(T1.AnswerText) , ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1 ORDER BY T1.AnswerText LIMIT 1 ) AS \"youngest id\" FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT MAX(T1.AnswerText), MIN(T1.AnswerText) , ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1 ORDER BY T1.AnswerText LIMIT 1 ) AS \"youngest id\" FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1", "index": 2258, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOldest user refer to MAX(AnswerText) where questionid = 1; Youngest user refer to MIN(AnswerText) where questionid = 1\n\nWhat are the ages of the oldest and youngest user that were surveyed? Indicate their user id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Maybe', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\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(AnswerText = 'Yes' Or AnswerText = 'Maybe'), COUNT(QuestionID = 12))* 100\nWhat is the percentage of the the users who would bring up a mental health issue with a potential employer in an interview?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 12", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 12", "index": 2259, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Maybe', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\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(AnswerText = 'Yes' Or AnswerText = 'Maybe'), COUNT(QuestionID = 12))* 100\nWhat is the percentage of the the users who would bring up a mental health issue with a potential employer in an interview?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2014 refer to SurveyID; COUNT(QuestionID) where COUNT(AnswerText) > 200\nHow many questions in 2014's survey had more than 200 answers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(QuestionID) FROM Answer WHERE SurveyID LIKE 2014 GROUP BY QuestionID ORDER BY COUNT(QuestionID) > 200 LIMIT 1", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(QuestionID) FROM Answer WHERE SurveyID LIKE 2014 GROUP BY QuestionID ORDER BY COUNT(QuestionID) > 200 LIMIT 1", "index": 2260, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2014 refer to SurveyID; COUNT(QuestionID) where COUNT(AnswerText) > 200\nHow many questions in 2014's survey had more than 200 answers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2014 refer to SurveyID; Answered No refer to AnswerText = 'No'; Question refer to questiontext\n\n\nHow many users answered \"No\" to the question \"Would you bring up a mental health issue with a potential employer in an interview?\" in 2014's survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND T2.SurveyID = 2014 AND T2.AnswerText LIKE 'NO'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND T2.SurveyID = 2014 AND T2.AnswerText LIKE 'NO'", "index": 2261, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2014 refer to SurveyID; Answered No refer to AnswerText = 'No'; Question refer to questiontext\n\n\nHow many users answered \"No\" to the question \"Would you bring up a mental health issue with a potential employer in an interview?\" in 2014's survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Physical health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2014 refer to SurveyID; Question refer to questiontext; yes refer to AnswerText = 'Yes'\n\n\nPlease list the IDs of the users who answered \"Yes\" to the question \"Do you think that discussing a physical health issue with your employer would have negative consequences?\" in 2014's survey.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Do you think that discussing a physical health issue with your employer would have negative consequences?' AND T2.AnswerText LIKE 'Yes' AND T2.SurveyID = 2014", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Do you think that discussing a physical health issue with your employer would have negative consequences?' AND T2.AnswerText LIKE 'Yes' AND T2.SurveyID = 2014", "index": 2262, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Physical health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2014 refer to SurveyID; Question refer to questiontext; yes refer to AnswerText = 'Yes'\n\n\nPlease list the IDs of the users who answered \"Yes\" to the question \"Do you think that discussing a physical health issue with your employer would have negative consequences?\" in 2014's survey.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nusers with a mental health disorder in the past refers to AnswerText(QuestionID(32)) = 'Yes'\nAccording to 2016's survey, what is the number of users with a mental health disorder in the past?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = 'Yes'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = 'Yes'", "index": 2263, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nusers with a mental health disorder in the past refers to AnswerText(QuestionID(32)) = 'Yes'\nAccording to 2016's survey, what is the number of users with a mental health disorder in the past?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquestion refers to questiontext; answered 'Yes' to question refers to AnswerText = 'Yes'; 3 consecutive years starting from 2016 refers to SurveyID = 2016 and SurveyID = 2017 and SurveyID = 2018\nHow many users answered \"Yes\" to the question \"Have you had a mental health disorder in the past?\" in 3 consecutive years starting from 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID IN (2016, 2017, 2018) AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = 'Yes'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID IN (2016, 2017, 2018) AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = 'Yes'", "index": 2264, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquestion refers to questiontext; answered 'Yes' to question refers to AnswerText = 'Yes'; 3 consecutive years starting from 2016 refers to SurveyID = 2016 and SurveyID = 2017 and SurveyID = 2018\nHow many users answered \"Yes\" to the question \"Have you had a mental health disorder in the past?\" in 3 consecutive years starting from 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage result refers to avg(AnswerText(SurveyID = 2014& QuestionID = 1))\nWhat is the average result of the question \"What is your age?\" in 2014's survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T2.AnswerText) AS REAL) / COUNT(T2.UserID) AS \"avg\" FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2014 AND T1.questiontext LIKE 'What is your age?'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT CAST(SUM(T2.AnswerText) AS REAL) / COUNT(T2.UserID) AS \"avg\" FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2014 AND T1.questiontext LIKE 'What is your age?'", "index": 2265, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage result refers to avg(AnswerText(SurveyID = 2014& QuestionID = 1))\nWhat is the average result of the question \"What is your age?\" in 2014's survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrate of increase = subtract(divide(count(SurveyID = 2019& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2019& QuestionID = 33)), divide(count(SurveyID = 2016& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 33)))\nWhat is the rate of increase of users with a current mental disorder from 2019's survey to 2016's survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2019 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) - ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) AS REAL) * 100 / ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' )", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT CAST(( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2019 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) - ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) AS REAL) * 100 / ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' )", "index": 2266, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrate of increase = subtract(divide(count(SurveyID = 2019& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2019& QuestionID = 33)), divide(count(SurveyID = 2016& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 33)))\nWhat is the rate of increase of users with a current mental disorder from 2019's survey to 2016's survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2018', 'mental health survey for 2019', 'mental health survey for 2017', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmental health survey for 2018 refers to SurveyID = 2018\nState the number of questions that were asked in the \"mental health survey for 2018\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.QuestionID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T1.QuestionID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018'", "index": 2267, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2018', 'mental health survey for 2019', 'mental health survey for 2017', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmental health survey for 2018 refers to SurveyID = 2018\nState the number of questions that were asked in the \"mental health survey for 2018\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquestion refers to questiontext; user No. 2681 refers to UserID = 2681\n\n\nWhat answer did user No. 2681 give to the question \"Do you currently have a mental health disorder?\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext = 'Do you currently have a mental health disorder?' AND T1.UserID = 2681", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext = 'Do you currently have a mental health disorder?' AND T1.UserID = 2681", "index": 2268, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquestion refers to questiontext; user No. 2681 refers to UserID = 2681\n\n\nWhat answer did user No. 2681 give to the question \"Do you currently have a mental health disorder?\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What country do you work in?', 'What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost common answer refers to AnswerText where MAX(COUNT(AnswerText(QuestionID = 3)))\nWhat was the most common answer for the question \"What country do you work 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.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext = 'What country do you work in?' GROUP BY T1.AnswerText ORDER BY COUNT(T1.AnswerText) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext = 'What country do you work in?' GROUP BY T1.AnswerText ORDER BY COUNT(T1.AnswerText) DESC LIMIT 1", "index": 2269, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What country do you work in?', 'What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost common answer refers to AnswerText where MAX(COUNT(AnswerText(QuestionID = 3)))\nWhat was the most common answer for the question \"What country do you work 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 Answer (\n AnswerText text, -- example: ['Mental health', 'All', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave asked refers to questiontext; said 'Yes' refers to AnswerText = 'Yes'\nFor all the users who have been asked \"Have you ever been diagnosed with a mental health disorder?\", how many of them said \"Yes\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Have you ever been diagnosed with a mental health disorder?' AND T1.AnswerText = 'Yes'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Have you ever been diagnosed with a mental health disorder?' AND T1.AnswerText = 'Yes'", "index": 2270, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'All', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave asked refers to questiontext; said 'Yes' refers to AnswerText = 'Yes'\nFor all the users who have been asked \"Have you ever been diagnosed with a mental health disorder?\", how many of them said \"Yes\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2018', 'mental health survey for 2019', 'mental health survey for 2017', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmental health survey for 2018 refers to SurveyID = 2018\nGive the number of users who took the \"mental health survey for 2018\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018'", "index": 2271, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2018', 'mental health survey for 2019', 'mental health survey for 2017', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmental health survey for 2018 refers to SurveyID = 2018\nGive the number of users who took the \"mental health survey for 2018\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Bipolar disorder', 'Depression', '37', '44']\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquestion refers to questiontext; user No.2183 refers to userID = 2183\nFor which question did the user No.2183 gave the answer \"Mood Disorder (Depression, Bipolar Disorder, etc)\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 2183 AND T1.AnswerText = 'Mood Disorder (Depression, Bipolar Disorder, etc)'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 2183 AND T1.AnswerText = 'Mood Disorder (Depression, Bipolar Disorder, etc)'", "index": 2272, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Bipolar disorder', 'Depression', '37', '44']\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquestion refers to questiontext; user No.2183 refers to userID = 2183\nFor which question did the user No.2183 gave the answer \"Mood Disorder (Depression, Bipolar Disorder, etc)\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2018', 'mental health survey for 2017', 'mental health survey for 2019', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\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 times more = subtract(count(UserID(SurveyID = 2017)), count(UserID(SurveyID = 2018)))\nHow many times more for the number of users who took the \"mental health survey for 2017\" than \"mental health survey for 2018\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T1.UserID) AS REAL) / ( SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018' ) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2017'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT CAST(COUNT(T1.UserID) AS REAL) / ( SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018' ) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2017'", "index": 2273, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2018', 'mental health survey for 2017', 'mental health survey for 2019', 'mental health survey for 2016', 'mental health survey for 2014']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\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 times more = subtract(count(UserID(SurveyID = 2017)), count(UserID(SurveyID = 2018)))\nHow many times more for the number of users who took the \"mental health survey for 2017\" than \"mental health survey for 2018\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrespondents and 'users' are synonyms; percentage = divide(count(SurveyID = 2016& QuestionID = 32 & AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 32))*100%\nAmong respondents who participated in the survey in 2016, what percentage had a mental health disorder in the past?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SurveyID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 32 AND T1.SurveyID = 2016", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SurveyID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 32 AND T1.SurveyID = 2016", "index": 2274, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Mental health', 'Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrespondents and 'users' are synonyms; percentage = divide(count(SurveyID = 2016& QuestionID = 32 & AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 32))*100%\nAmong respondents who participated in the survey in 2016, what percentage had a mental health disorder in the past?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrespondents and 'users' are synonyms; average number = avg(count(userID(SurveyID = 2014)), count(userID(SurveyID = 2019)))\nWhat is the average number of respondents per survey between 2014 and 2019?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(SurveyID) AS REAL) / 5 FROM Answer WHERE SurveyID BETWEEN 2014 AND 2019", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT CAST(COUNT(SurveyID) AS REAL) / 5 FROM Answer WHERE SurveyID BETWEEN 2014 AND 2019", "index": 2275, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Question (\n questiontext text, -- example: ['What is your age?', 'What is your gender?']\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrespondents and 'users' are synonyms; average number = avg(count(userID(SurveyID = 2014)), count(userID(SurveyID = 2019)))\nWhat is the average number of respondents per survey between 2014 and 2019?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrespondents' and 'users' are synonyms; work remotely at least 50% of the time refers to AnswerText(SurveyID = 2014& QuestionID = 93) = 'Yes'\nHow many respondents who participated in the survey in 2014 work remotely at least 50% of the time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.AnswerText) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 93 AND T1.SurveyID = 2014 AND T1.AnswerText = 'Yes'", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(T1.AnswerText) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 93 AND T1.SurveyID = 2014 AND T1.AnswerText = 'Yes'", "index": 2276, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Answer (\n AnswerText text, -- example: ['Yes', '37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrespondents' and 'users' are synonyms; work remotely at least 50% of the time refers to AnswerText(SurveyID = 2014& QuestionID = 93) = 'Yes'\nHow many respondents who participated in the survey in 2014 work remotely at least 50% of the time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\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 questions were asked in the questionary for the mental health survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(questiontext) FROM Question", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT COUNT(questiontext) FROM Question", "index": 2277, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n Description text, -- example: ['mental health survey for 2014', 'mental health survey for 2016']\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Answer (\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\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 questions were asked in the questionary for the mental health survey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\n\nsurvey in 2017 refers to SurveyID = 2017; questionID = 85; MAX(COUNT(AnswerText))\nList the top three popular responses to the question of the survey in 2017 with the question ID no.85.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AnswerText FROM Answer WHERE QuestionID = 85 AND SurveyID = 2017 GROUP BY AnswerText ORDER BY COUNT(AnswerText) DESC LIMIT 3", "style": "rule" }
{ "db_id": "mental_health_survey.sqlite", "gt_sql": "SELECT AnswerText FROM Answer WHERE QuestionID = 85 AND SurveyID = 2017 GROUP BY AnswerText ORDER BY COUNT(AnswerText) DESC LIMIT 3", "index": 2278, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Answer (\n AnswerText text, -- example: ['37', '44']\n SurveyID integer, -- example: [2014, 2016]\n UserID integer, -- example: [1, 2]\n QuestionID integer, -- example: [1, 2]\n PRIMARY KEY (UserID, QuestionID)\n);\n\nCREATE TABLE Survey (\n SurveyID integer, -- example: [2014, 2016]\n PRIMARY KEY (SurveyID)\n);\n\nCREATE TABLE Question (\n questionid integer, -- example: [1, 2]\n PRIMARY KEY (questionid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\n\nsurvey in 2017 refers to SurveyID = 2017; questionID = 85; MAX(COUNT(AnswerText))\nList the top three popular responses to the question of the survey in 2017 with the question ID no.85.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Walt Disney', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(SUM(Year = 1998), SUM(Year = 1997))\nHow much more total box office gross did the Walt Disney Company have in revenue in 1998 than in 1997?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 `Year` = 1998 THEN Total ELSE 0 END) - SUM(CASE WHEN `Year` = 1997 THEN Total ELSE 0 END) FROM revenue", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT SUM(CASE WHEN `Year` = 1998 THEN Total ELSE 0 END) - SUM(CASE WHEN `Year` = 1997 THEN Total ELSE 0 END) FROM revenue", "index": 2279, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Walt Disney', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(SUM(Year = 1998), SUM(Year = 1997))\nHow much more total box office gross did the Walt Disney Company have in revenue in 1998 than in 1997?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nStudio Entertainment[NI 1]' > 'Disney Media Networks' where Year = 1998;\nIn which segment did the Walt Disney Company earned a bigger revenue in 1998, Studio Entertainment or Disney Media Networks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CASE WHEN 'Studio Entertainment[NI 1]' > 'Disney Media Networks' THEN 'Studio Entertainment[NI 1]' ELSE 'Disney Media Networks' END FROM revenue WHERE `Year` = 1998", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT CASE WHEN 'Studio Entertainment[NI 1]' > 'Disney Media Networks' THEN 'Studio Entertainment[NI 1]' ELSE 'Disney Media Networks' END FROM revenue WHERE `Year` = 1998", "index": 2280, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nStudio Entertainment[NI 1]' > 'Disney Media Networks' where Year = 1998;\nIn which segment did the Walt Disney Company earned a bigger revenue in 1998, Studio Entertainment or Disney Media Networks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Alan Tudyk', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased after 2012 refers to (release_date, instr(release_date, '-') + 5) > 12;\nAmong the movies in which Alan Tudyk is a voice actor, how many of them were released after 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.movie) FROM characters AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T2.`voice-actor` = 'Alan Tudyk' AND SUBSTR(release_date, INSTR(release_date, '-') + 5) > 12", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT COUNT(T2.movie) FROM characters AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T2.`voice-actor` = 'Alan Tudyk' AND SUBSTR(release_date, INSTR(release_date, '-') + 5) > 12", "index": 2281, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Alan Tudyk', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased after 2012 refers to (release_date, instr(release_date, '-') + 5) > 12;\nAmong the movies in which Alan Tudyk is a voice actor, how many of them were released after 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Comedy', 'Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirected by Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; comedies refers to genre = 'Comedy'; movies refer to movie_title;\nAmong the movies directed by Wolfgang Reitherman, how many of them are Comedies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T3.name) FROM ( SELECT T2.name FROM `movies_total_gross` AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' AND T1.genre = 'Comedy' GROUP BY T2.name ) T3", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT COUNT(T3.name) FROM ( SELECT T2.name FROM `movies_total_gross` AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' AND T1.genre = 'Comedy' GROUP BY T2.name ) T3", "index": 2282, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Comedy', 'Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirected by Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; comedies refers to genre = 'Comedy'; movies refer to movie_title;\nAmong the movies directed by Wolfgang Reitherman, how many of them are Comedies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirected by Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; movies refer to movie_title; general audience refers to MPAA_rating = 'G';\nPlease list the movies directed by Wolfgang Reitherman that can be watched by the general audience.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM `movies_total_gross` AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.MPAA_rating = 'G' AND T2.director = 'Wolfgang Reitherman'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title FROM `movies_total_gross` AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.MPAA_rating = 'G' AND T2.director = 'Wolfgang Reitherman'", "index": 2283, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirected by Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; movies refer to movie_title; general audience refers to MPAA_rating = 'G';\nPlease list the movies directed by Wolfgang Reitherman that can be watched by the general audience.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most popular movie refers to movie_title where MAX(total_gross);\nWhich character is the villain of the most popular movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.villian FROM `movies_total_gross` AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title ORDER BY T1.total_gross DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.villian FROM `movies_total_gross` AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title ORDER BY T1.total_gross DESC LIMIT 1", "index": 2284, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most popular movie refers to movie_title where MAX(total_gross);\nWhich character is the villain of the most popular movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Commander Rourke', 'Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat is the genre of the movie whose villain is Commander Rourke?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.genre FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T1.villian = 'Commander Rourke'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.genre FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T1.villian = 'Commander Rourke'", "index": 2285, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Commander Rourke', 'Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat is the genre of the movie whose villain is Commander Rourke?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Beast', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Beauty and the Beast', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Beauty and the Beast', 'Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['Beauty and the Beast', '101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Beauty and the Beast', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBeauty and the Beast refers to movie_title = 'Beauty and the Beast';\nWho is the villain of the movie \"Beauty and the Beast\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT villian FROM characters WHERE movie_title = 'Beauty and the Beast'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT villian FROM characters WHERE movie_title = 'Beauty and the Beast'", "index": 2286, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Beast', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Beauty and the Beast', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Beauty and the Beast', 'Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['Beauty and the Beast', '101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Beauty and the Beast', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBeauty and the Beast refers to movie_title = 'Beauty and the Beast';\nWho is the villain of the movie \"Beauty and the Beast\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$222,527,828', '$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWho is the hero character of the movie whose total gross was $222,527,828?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.total_gross = '$222,527,828'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.total_gross = '$222,527,828'", "index": 2287, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$222,527,828', '$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWho is the hero character of the movie whose total gross was $222,527,828?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most popular movie refers to movie_title where MAX(total_gross); in 1970s refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1970 and 1979);\nWhich song is associated with the most popular Disney movie in 1970s?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE CAST(SUBSTR(T1.release_date, INSTR(T1.release_date, ', ') + 1) AS int) BETWEEN 1970 AND 1979 ORDER BY CAST(REPLACE(SUBSTR(T1.total_gross, 2), ',', '') AS float) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE CAST(SUBSTR(T1.release_date, INSTR(T1.release_date, ', ') + 1) AS int) BETWEEN 1970 AND 1979 ORDER BY CAST(REPLACE(SUBSTR(T1.total_gross, 2), ',', '') AS float) DESC LIMIT 1", "index": 2288, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most popular movie refers to movie_title where MAX(total_gross); in 1970s refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1970 and 1979);\nWhich song is associated with the most popular Disney movie in 1970s?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Will Finn', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWill Finn refers to director = 'Will Finn';\nWho is the hero character of the Disney movie directed by Will Finn?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.hero FROM characters AS T1 INNER JOIN director AS T2 ON T2.name = T1.movie_title WHERE T2.director = 'Will Finn'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.hero FROM characters AS T1 INNER JOIN director AS T2 ON T2.name = T1.movie_title WHERE T2.director = 'Will Finn'", "index": 2289, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Will Finn', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWill Finn refers to director = 'Will Finn';\nWho is the hero character of the Disney movie directed by Will Finn?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWolfgang Reitherman refers to director = 'Wolfgang Reitherman'; the highest grossing after accounting for inflation refers to MAX(inflation_adjusted_gross);\nWolfgang Reitherman has directed several Disney movies, which one has the highest grossing after accounting for inflation?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' ORDER BY CAST(REPLACE(SUBSTR(inflation_adjusted_gross, 2), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' ORDER BY CAST(REPLACE(SUBSTR(inflation_adjusted_gross, 2), ',', '') AS REAL) DESC LIMIT 1", "index": 2290, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWolfgang Reitherman refers to director = 'Wolfgang Reitherman'; the highest grossing after accounting for inflation refers to MAX(inflation_adjusted_gross);\nWolfgang Reitherman has directed several Disney movies, which one has the highest grossing after accounting for inflation?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['4-Mar-16', '21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Adventure', 'Musical']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased on 2016/3/4 refers to release_date = '4-Mar-16'; adventure movie refers to genre = 'Adventure' ;\nWho is the hero character of the adventure movie which was released on 2016/3/4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.genre = 'Adventure' AND T1.release_date = '4-Mar-16'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.genre = 'Adventure' AND T1.release_date = '4-Mar-16'", "index": 2291, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['4-Mar-16', '21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Adventure', 'Musical']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased on 2016/3/4 refers to release_date = '4-Mar-16'; adventure movie refers to genre = 'Adventure' ;\nWho is the hero character of the adventure movie which was released on 2016/3/4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Horror', 'Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['R', 'G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRestricted refers to MPAA_rating = 'R'; horror refers to genre = 'Horror'; released between 1/1/1990 to 12/31/2015 refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1990 and 2015);\nHow many restricted horror movies were released between 1/1/1990 to 12/31/2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'R' AND genre = 'Horror' AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2015", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'R' AND genre = 'Horror' AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2015", "index": 2292, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Horror', 'Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['R', 'G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRestricted refers to MPAA_rating = 'R'; horror refers to genre = 'Horror'; released between 1/1/1990 to 12/31/2015 refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1990 and 2015);\nHow many restricted horror movies were released between 1/1/1990 to 12/31/2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Frank', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Frank Welker', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrank Welker refers to voice-actor = 'Frank Welker';\nWhat are the names of the characters voiced by Frank Welker?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT character FROM `voice-actors` WHERE 'voice-actor' = 'Frank Welker'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT character FROM `voice-actors` WHERE 'voice-actor' = 'Frank Welker'", "index": 2293, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Frank', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Frank Welker', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrank Welker refers to voice-actor = 'Frank Welker';\nWhat are the names of the characters voiced by Frank Welker?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Turbo', 'Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe Motion Picture Association of America rating refers to MPAA_rating; villian = 'Turbo';\nWhat is the Motion Picture Association of America rating for the movie featuring a villain named Turbo?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.villian = 'Turbo'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.villian = 'Turbo'", "index": 2294, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Turbo', 'Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe Motion Picture Association of America rating refers to MPAA_rating; villian = 'Turbo';\nWhat is the Motion Picture Association of America rating for the movie featuring a villain named Turbo?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Bill Thompson', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBill Thompson refers to voice-actor = 'Bill Thompson'; worked the most refers to MAX(COUNT(name));\nWhich director did Bill Thompson work the most with?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT director FROM director AS T1 INNER JOIN `voice-actors` AS T2 ON T1.name = T2.movie WHERE T2.`voice-actor` = 'Bill Thompson' GROUP BY director ORDER BY COUNT(director) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT director FROM director AS T1 INNER JOIN `voice-actors` AS T2 ON T1.name = T2.movie WHERE T2.`voice-actor` = 'Bill Thompson' GROUP BY director ORDER BY COUNT(director) DESC LIMIT 1", "index": 2295, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Bill Thompson', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBill Thompson refers to voice-actor = 'Bill Thompson'; worked the most refers to MAX(COUNT(name));\nWhich director did Bill Thompson work the most with?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Ben Sharpsteen', 'David Hand']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Ben', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Feb 9, 1940', 'Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBen Sharpsteen refers to director = 'Ben Sharpsteen'; released on February 9, 1940 refers to release_date = 'Feb 9, 1940';\nList all the voice actors in the movie directed by Ben Sharpsteen which was released on February 9, 1940.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.`voice-actor` FROM director AS T1 INNER JOIN `voice-actors` AS T2 INNER JOIN movies_total_gross AS T3 ON T1.name = T2.movie AND T2.movie = T3.movie_title WHERE T1.director = 'Ben Sharpsteen' AND T3.release_date = 'Feb 9, 1940' AND T2.`voice-actor` != 'None' GROUP BY T2.`voice-actor`", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.`voice-actor` FROM director AS T1 INNER JOIN `voice-actors` AS T2 INNER JOIN movies_total_gross AS T3 ON T1.name = T2.movie AND T2.movie = T3.movie_title WHERE T1.director = 'Ben Sharpsteen' AND T3.release_date = 'Feb 9, 1940' AND T2.`voice-actor` != 'None' GROUP BY T2.`voice-actor`", "index": 2296, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Ben Sharpsteen', 'David Hand']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Ben', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Feb 9, 1940', 'Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBen Sharpsteen refers to director = 'Ben Sharpsteen'; released on February 9, 1940 refers to release_date = 'Feb 9, 1940';\nList all the voice actors in the movie directed by Ben Sharpsteen which was released on February 9, 1940.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['The Great Mouse Detective', '101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['The Great Mouse Detective', 'Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['The Great Mouse Detective', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['The Great Mouse Detective', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe Great Mouse Detective refers to movie_title = 'The Great Mouse Detective';\nWho is the villain in the movie \"The Great Mouse Detective\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT villian FROM characters WHERE movie_title = 'The Great Mouse Detective'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT villian FROM characters WHERE movie_title = 'The Great Mouse Detective'", "index": 2297, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['The Great Mouse Detective', '101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['The Great Mouse Detective', 'Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['The Great Mouse Detective', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['The Great Mouse Detective', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe Great Mouse Detective refers to movie_title = 'The Great Mouse Detective';\nWho is the villain in the movie \"The Great Mouse Detective\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most movies refers to MAX(COUNT(name));\nWhich director has made the most movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT director, COUNT(name) FROM director GROUP BY director ORDER BY COUNT(name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT director, COUNT(name) FROM director GROUP BY director ORDER BY COUNT(name) DESC LIMIT 1", "index": 2298, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most movies refers to MAX(COUNT(name));\nWhich director has made the most movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 1990s refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1990 and 2000);\nProvide a list of directors from the 1990s.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2000 GROUP BY T2.director", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2000 GROUP BY T2.director", "index": 2299, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 1990s refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1990 and 2000);\nProvide a list of directors from the 1990s.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }