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 ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011;\nHow many students were there in university ID 1 in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT num_students FROM university_year WHERE year = 2011 AND university_id = 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT num_students FROM university_year WHERE year = 2011 AND university_id = 1",
"index": 3800,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011;\nHow many students were there in university ID 1 in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; student staff ratio of over 15 refers to student_staff_ratio > 15; ID of the university refers to university_id\nPlease list the IDs of the universities with a student staff ratio of over 15 in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT university_id FROM university_year WHERE year = 2011 AND student_staff_ratio > 15",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT university_id FROM university_year WHERE year = 2011 AND student_staff_ratio > 15",
"index": 3801,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; student staff ratio of over 15 refers to student_staff_ratio > 15; ID of the university refers to university_id\nPlease list the IDs of the universities with a student staff ratio of over 15 in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; with over 20000 students refers to num_students > 20000; international students percentage of over 25% refers to pct_international_students > 25;\nAmong the universities with over 20000 students in 2011, how many of them have an international students percentage of over 25% in the same year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM university_year WHERE year = 2011 AND pct_international_students > 25 AND num_students > 20000",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT COUNT(*) FROM university_year WHERE year = 2011 AND pct_international_students > 25 AND num_students > 20000",
"index": 3802,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; with over 20000 students refers to num_students > 20000; international students percentage of over 25% refers to pct_international_students > 25;\nAmong the universities with over 20000 students in 2011, how many of them have an international students percentage of over 25% in the same year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; the most international students refers to MAX(DIVIDE(MULTIPLY(num_students, pct_international_students), 100)); name of university refers to university_id\nWhat is the name of the university with the most international students in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 ORDER BY T1.pct_international_students DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 ORDER BY T1.pct_international_students DESC LIMIT 1",
"index": 3803,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; the most international students refers to MAX(DIVIDE(MULTIPLY(num_students, pct_international_students), 100)); name of university refers to university_id\nWhat is the name of the university with the most international students in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Australia', 'Argentina']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Australia refers to country_name = 'Australia'; name of university refers to university_name\nPlease list the names of all the universities in Australia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.university_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Australia'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T1.university_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Australia'",
"index": 3804,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Australia', 'Argentina']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Australia refers to country_name = 'Australia'; name of university refers to university_name\nPlease list the names of all the universities in Australia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; in teaching refers to criteria_name = 'Teaching'; score in teaching of over 90 refers to score > 90; name of university refers to university_name;\nPlease list the names of the universities with a score in teaching of over 90 in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score > 90",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score > 90",
"index": 3805,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; in teaching refers to criteria_name = 'Teaching'; score in teaching of over 90 refers to score > 90; name of university refers to university_name;\nPlease list the names of the universities with a score in teaching of over 90 in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['United States of America', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; in teaching refers to criteria_name = 'Teaching'; score in teaching of over 90 refers to score > 90; in the United States of America refers to country_name = 'United States of America';\nAmong the universities with a score in teaching of over 90 in 2011, how many of them are in the United States of America?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score > 90",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score > 90",
"index": 3806,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['United States of America', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; in teaching refers to criteria_name = 'Teaching'; score in teaching of over 90 refers to score > 90; in the United States of America refers to country_name = 'United States of America';\nAmong the universities with a score in teaching of over 90 in 2011, how many of them are in the United States of America?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; that got 98 refers to score = 98; in teaching refers to criteria_name = 'Teaching'; name of university refers to university_name\nWhat are the names of the universities that got 98 in teaching in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score = 98",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Teaching' AND T2.year = 2011 AND T2.score = 98",
"index": 3807,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; that got 98 refers to score = 98; in teaching refers to criteria_name = 'Teaching'; name of university refers to university_name\nWhat are the names of the universities that got 98 in teaching in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['United States of America', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nscored under 60 refers to score < 60; in 2011 refers to year 2011; in teaching refers to criteria_name = 'Teaching'; in the United States of America refers to country_name = 'United States of America';\nPlease list the names of all the universities that scored under 60 in teaching in 2011 and are in the United States of America.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id INNER JOIN country AS T4 ON T4.id = T3.country_id WHERE T4.country_name = 'United States of America' AND T2.year = 2011 AND T2.score < 60 AND T1.criteria_name = 'Teaching'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id INNER JOIN country AS T4 ON T4.id = T3.country_id WHERE T4.country_name = 'United States of America' AND T2.year = 2011 AND T2.score < 60 AND T1.criteria_name = 'Teaching'",
"index": 3808,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['United States of America', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nscored under 60 refers to score < 60; in 2011 refers to year 2011; in teaching refers to criteria_name = 'Teaching'; in the United States of America refers to country_name = 'United States of America';\nPlease list the names of all the universities that scored under 60 in teaching in 2011 and are in the United States of America.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Stanford University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; female students refers to DIVIDE(MULTIPLY(pct_female_students, num_students), 100); Stanford University refers to university_name = 'Stanford University';\nHow many female students did Stanford University have in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T1.num_students * T1.pct_female_students AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 AND T2.university_name = 'Stanford University'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT CAST(T1.num_students * T1.pct_female_students AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 AND T2.university_name = 'Stanford University'",
"index": 3809,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Stanford University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; female students refers to DIVIDE(MULTIPLY(pct_female_students, num_students), 100); Stanford University refers to university_name = 'Stanford University';\nHow many female students did Stanford University have in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Orléans', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUniversity of Orléans refers to university_name = 'University of Orléans';\nShow the id of University of Orléans.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT id FROM university WHERE university_name = 'University of Orléans'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT id FROM university WHERE university_name = 'University of Orléans'",
"index": 3810,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Orléans', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUniversity of Orléans refers to university_name = 'University of Orléans';\nShow the id of University of Orléans.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of country refers to country_name\nShow the name of country id 66.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT country_name FROM country WHERE id = 66",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT country_name FROM country WHERE id = 66",
"index": 3811,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of country refers to country_name\nShow the name of country id 66.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['McMaster University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n num_students integer, -- number of students, example: [20152, 2243]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMcMaster University refers to university_name = 'McMaster University'; which country refers to country_name\nWhich country is McMaster University located 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 T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T1.university_name = 'McMaster University'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T1.university_name = 'McMaster University'",
"index": 3812,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['McMaster University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n num_students integer, -- number of students, example: [20152, 2243]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMcMaster University refers to university_name = 'McMaster University'; which country refers to country_name\nWhich country is McMaster University located 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 country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; the most students refers to MAX(num_students); which university refers to university_name;\nWhich university had the most students in 2011? Show its name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 ORDER BY T1.num_students DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 ORDER BY T1.num_students DESC LIMIT 1",
"index": 3813,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year 2011; the most students refers to MAX(num_students); which university refers to university_name;\nWhich university had the most students in 2011? Show its name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Chosun University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Influence Rank', 'Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChosun University refers to university_name = 'Chosun University'; in 2015 refers to year = 2015; on \"Influence Rank\" refers to criteria_name = 'Influence Rank';\nFor Chosun University, what was its score on \"Influence Rank\" in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.score FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'Chosun University' AND T1.criteria_name = 'Influence Rank' AND T2.year = 2015",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.score FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'Chosun University' AND T1.criteria_name = 'Influence Rank' AND T2.year = 2015",
"index": 3814,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Chosun University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Influence Rank', 'Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChosun University refers to university_name = 'Chosun University'; in 2015 refers to year = 2015; on \"Influence Rank\" refers to criteria_name = 'Influence Rank';\nFor Chosun University, what was its score on \"Influence Rank\" in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Oslo', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage of the international students refers to pct_international_students; in 2015 refers to year = 2015; in University of Oslo refers to university_name = 'University of Oslo';\nWhat is the percentage of the international students in University of Oslo in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.pct_international_students FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id WHERE T1.university_name = 'University of Oslo' AND T2.year = 2015",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.pct_international_students FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id WHERE T1.university_name = 'University of Oslo' AND T2.year = 2015",
"index": 3815,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Oslo', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage of the international students refers to pct_international_students; in 2015 refers to year = 2015; in University of Oslo refers to university_name = 'University of Oslo';\nWhat is the percentage of the international students in University of Oslo in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Southampton', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUniversity of Southampton refers to university_name = 'University of Southampton'; in 2015 refers to year = 2015; score the best refers to MAX(score); which criteria refers to criteria_name\nFor the University of Southampton in 2015, on which criteria did it score the best?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.criteria_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'University of Southampton' AND T2.year = 2015 ORDER BY T2.score DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T1.criteria_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'University of Southampton' AND T2.year = 2015 ORDER BY T2.score DESC LIMIT 1",
"index": 3816,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Southampton', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUniversity of Southampton refers to university_name = 'University of Southampton'; in 2015 refers to year = 2015; score the best refers to MAX(score); which criteria refers to criteria_name\nFor the University of Southampton in 2015, on which criteria did it score the best?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Total Shanghai', 'Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncriteria \"Total Shanghai\" refers to criteria_name = 'Total Shanghai'; which ranking system refers to system_name\nWhich ranking system is criteria \"Total Shanghai\" 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.system_name FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T2.criteria_name = 'Total Shanghai'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T1.system_name FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T2.criteria_name = 'Total Shanghai'",
"index": 3817,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Total Shanghai', 'Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncriteria \"Total Shanghai\" refers to criteria_name = 'Total Shanghai'; which ranking system refers to system_name\nWhich ranking system is criteria \"Total Shanghai\" 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 university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Wisconsin-Madison', 'University of Wisconsin', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninternational students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); University of Wisconsin-Madison refers to university_name = 'University of Wisconsin-Madison'; in 2013 refers to year = 2013\nCalculate the number of international students of University of Wisconsin-Madison in 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(T1.num_students * T1.pct_international_students AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2013 AND T2.university_name = 'University of Wisconsin-Madison'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT CAST(T1.num_students * T1.pct_international_students AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2013 AND T2.university_name = 'University of Wisconsin-Madison'",
"index": 3818,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Wisconsin-Madison', 'University of Wisconsin', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninternational students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); University of Wisconsin-Madison refers to university_name = 'University of Wisconsin-Madison'; in 2013 refers to year = 2013\nCalculate the number of international students of University of Wisconsin-Madison in 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest number of students refers to MIN(num_students); in 2015 refers to year = 2015; name of university refers to university_name;\nShow the name of the university with the lowest number of students in 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students ASC LIMIT 1",
"index": 3819,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest number of students refers to MIN(num_students); in 2015 refers to year = 2015; name of university refers to university_name;\nShow the name of the university with the lowest number of students in 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of students refers to avg(num_students); in 2012 refers to year = 2012\nCalculate the average number of students of all universities in 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 AVG(num_students) FROM university_year WHERE year = 2012",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT AVG(num_students) FROM university_year WHERE year = 2012",
"index": 3820,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of students refers to avg(num_students); in 2012 refers to year = 2012\nCalculate the average number of students of all universities in 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 university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2015 refers to year = 2015\nWhat is the score of university ID 68 in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT score FROM university_ranking_year WHERE year = 2015 AND university_id = 68",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT score FROM university_ranking_year WHERE year = 2015 AND university_id = 68",
"index": 3821,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2015 refers to year = 2015\nWhat is the score of university ID 68 in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlargest percentage of international students refers to MAX(pct_international_students); ID of university refers to university_id\nWhat is the ID of university with the largest percentage of international 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 university_id FROM university_year ORDER BY pct_international_students DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT university_id FROM university_year ORDER BY pct_international_students DESC LIMIT 1",
"index": 3822,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlargest percentage of international students refers to MAX(pct_international_students); ID of university refers to university_id\nWhat is the ID of university with the largest percentage of international 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 university_year (\n university_id integer, -- example: [1, 5]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the criteria name of the ranking criteria ID 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 criteria_name FROM ranking_criteria WHERE id = 13",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT criteria_name FROM ranking_criteria WHERE id = 13",
"index": 3823,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the criteria name of the ranking criteria ID 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 country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the student staff ratio of university ID 35.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT student_staff_ratio FROM university_year WHERE university_id = 35",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT student_staff_ratio FROM university_year WHERE university_id = 35",
"index": 3824,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the student staff ratio of university ID 35.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHarvard University refers to university_name = 'Harvard University'; scored 100 refers to score = 100\nGive the criteria name where Harvard University scored 100.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.criteria_name FROM university AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.university_id INNER JOIN ranking_criteria AS T3 ON T3.id = T2.ranking_criteria_id WHERE T1.university_name = 'Harvard University' AND T2.score = 100",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT DISTINCT T3.criteria_name FROM university AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.university_id INNER JOIN ranking_criteria AS T3 ON T3.id = T2.ranking_criteria_id WHERE T1.university_name = 'Harvard University' AND T2.score = 100",
"index": 3825,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHarvard University refers to university_name = 'Harvard University'; scored 100 refers to score = 100\nGive the criteria name where Harvard University scored 100.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nscored below 50 refers to score < 50; all universities refers to university_name;\nList down all universities that scored below 50.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.university_name FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.score < 50",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT DISTINCT T2.university_name FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.score < 50",
"index": 3826,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nscored below 50 refers to score < 50; all universities refers to university_name;\nList down all universities that scored below 50.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Japan', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated in Japan refers to country_name = 'Japan';\nHow many universities are located in Japan?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Japan'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT COUNT(*) FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Japan'",
"index": 3827,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Japan', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated in Japan refers to country_name = 'Japan';\nHow many universities are located in Japan?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Brown University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBrown University refers to university_name = 'Brown University'; score the highest refers to MAX(score)\nIn what year does the Brown University score the highest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.year FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Brown University' ORDER BY T1.score DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T1.year FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Brown University' ORDER BY T1.score DESC LIMIT 1",
"index": 3828,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Brown University', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBrown University refers to university_name = 'Brown University'; score the highest refers to MAX(score)\nIn what year does the Brown University score the highest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost number of students refers to MAX(num_students); in 2015 refers to year = 2015; name of university refers to university_name;\nGive the name of the university with the most number of students in 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students DESC LIMIT 1",
"index": 3829,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['Teaching', 'International']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost number of students refers to MAX(num_students); in 2015 refers to year = 2015; name of university refers to university_name;\nGive the name of the university with the most number of students in 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['United States of America', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\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 DIVIDE(MULTIPLY(num_students, pct_female_students), 100); in United States of America refers to country_name = 'United States of America'; percentage refers to DIVIDE(SUM(DIVIDE(MULTIPLY(num_students, pct_female_students), 100)), SUM(num_students))\nAmong the universities in United States of America, what is the percentage of female students in year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CAST(T2.pct_female_students * T2.num_students AS REAL) / 100) * 100 / SUM(T2.num_students) FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T3.country_name = 'United States of America' AND T2.year = 2016",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT SUM(CAST(T2.pct_female_students * T2.num_students AS REAL) / 100) * 100 / SUM(T2.num_students) FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T3.country_name = 'United States of America' AND T2.year = 2016",
"index": 3830,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['United States of America', 'Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n student_staff_ratio real, -- example: [8.9, 6.9]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n pct_female_students integer, -- example: [33, 37]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\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 DIVIDE(MULTIPLY(num_students, pct_female_students), 100); in United States of America refers to country_name = 'United States of America'; percentage refers to DIVIDE(SUM(DIVIDE(MULTIPLY(num_students, pct_female_students), 100)), SUM(num_students))\nAmong the universities in United States of America, what is the percentage of female students in year 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Tokyo', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['International', 'Teaching']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninternational students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); difference refers to SUBTRACT(SUM(num_students), SUM(DIVIDE(MULTIPLY(num_students, pct_international_students), 100))); in University of Tokyo refers to university_name = 'University of Tokyo'; from 2011 to 2014 refers to year BETWEEN 2011 AND 2014\nCalculate the difference between the total number of students and the number of international international students in Univeristy of Tokyo from 2011 to 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.num_students) - SUM(CAST(T1.num_students * T1.pct_international_students AS REAL) / 100) FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year BETWEEN 2011 AND 2014 AND T2.university_name = 'University of Tokyo'",
"style": "rule"
} | {
"db_id": "university.sqlite",
"gt_sql": "SELECT SUM(T1.num_students) - SUM(CAST(T1.num_students * T1.pct_international_students AS REAL) / 100) FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year BETWEEN 2011 AND 2014 AND T2.university_name = 'University of Tokyo'",
"index": 3831,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n id integer, -- example: [1, 2]\n country_name text, -- example: ['Argentina', 'Australia']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university_year (\n university_id integer, -- example: [1, 5]\n `year` integer, -- example: [2011, 2012]\n num_students integer, -- number of students, example: [20152, 2243]\n pct_international_students integer, -- pct internation student, example: [25, 27]\n CONSTRAINT fk_university_year_university_id FOREIGN KEY (university_id) REFERENCES university (id)\n);\n\nCREATE TABLE ranking_system (\n id integer, -- example: [1, 2]\n system_name text, -- example: ['Times Higher Education World University ', 'Shanghai Ranking']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE university (\n id integer, -- example: [1, 2]\n country_id integer, -- example: [73, 72]\n university_name text, -- example: ['University of Tokyo', 'Harvard University', 'Massachusetts Institute of Technology']\n PRIMARY KEY (id),\n CONSTRAINT fk_university_country_id FOREIGN KEY (country_id) REFERENCES country (id)\n);\n\nCREATE TABLE university_ranking_year (\n university_id integer, -- example: [1, 5]\n ranking_criteria_id integer, -- example: [1, 2]\n `year` integer, -- example: [2011, 2012]\n score integer, -- example: [100, 98]\n CONSTRAINT fk_university_ranking_year_university_id FOREIGN KEY (university_id) REFERENCES university (id),\n CONSTRAINT fk_university_ranking_year_ranking_criteria_id FOREIGN KEY (ranking_criteria_id) REFERENCES ranking_criteria (id)\n);\n\nCREATE TABLE ranking_criteria (\n id integer, -- example: [1, 2]\n ranking_system_id integer, -- example: [1, 2]\n criteria_name text, -- example: ['International', 'Teaching']\n PRIMARY KEY (id),\n CONSTRAINT fk_ranking_criteria_ranking_system_id FOREIGN KEY (ranking_system_id) REFERENCES ranking_system (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninternational students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); difference refers to SUBTRACT(SUM(num_students), SUM(DIVIDE(MULTIPLY(num_students, pct_international_students), 100))); in University of Tokyo refers to university_name = 'University of Tokyo'; from 2011 to 2014 refers to year BETWEEN 2011 AND 2014\nCalculate the difference between the total number of students and the number of international international students in Univeristy of Tokyo from 2011 to 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n preciptotal real, -- example: [0.05, 0.01]\n sealevel real, -- example: [29.92, 29.62]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntemperature above the 30-year normal refers to depart > 0; station no.2 refers to station_nbr = 2\nPlease list the dates on which the temperature of station no.2 was above the 30-year normal.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT `date` FROM weather WHERE station_nbr = 2 AND depart > 0",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT `date` FROM weather WHERE station_nbr = 2 AND depart > 0",
"index": 3832,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n preciptotal real, -- example: [0.05, 0.01]\n sealevel real, -- example: [29.92, 29.62]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntemperature above the 30-year normal refers to depart > 0; station no.2 refers to station_nbr = 2\nPlease list the dates on which the temperature of station no.2 was above the 30-year normal.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-02', '2012-01-01']\n tmax integer, -- temperature max, example: [52, 50]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-02', '2012-01-01']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation no.1 refers to station_nbr = 1; 2012/1/1 refers to date = '2012-01-01'; 2012/1/2 refers to date = '2012-01-02'; more windy refers to Max(avgspeed)\nOn which day was the weather more windy in station no.1, 2012/1/1 or 2012/1/2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 (SUM(CASE WHEN `date` = '2012-01-01' THEN avgspeed ELSE 0 END) - SUM(CASE WHEN `date` = '2012-01-02' THEN avgspeed ELSE 0 END)) > 0 THEN '2012-01-01' ELSE '2012-01-02' END FROM weather WHERE station_nbr = 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT CASE WHEN (SUM(CASE WHEN `date` = '2012-01-01' THEN avgspeed ELSE 0 END) - SUM(CASE WHEN `date` = '2012-01-02' THEN avgspeed ELSE 0 END)) > 0 THEN '2012-01-01' ELSE '2012-01-02' END FROM weather WHERE station_nbr = 1",
"index": 3833,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-02', '2012-01-01']\n tmax integer, -- temperature max, example: [52, 50]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-02', '2012-01-01']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation no.1 refers to station_nbr = 1; 2012/1/1 refers to date = '2012-01-01'; 2012/1/2 refers to date = '2012-01-02'; more windy refers to Max(avgspeed)\nOn which day was the weather more windy in station no.1, 2012/1/1 or 2012/1/2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; in 2012 refers to SUBSTR(date, 1, 4) = '2012': most units sold refers to Max(units)\nWhat was the dew point on the day the most units of item no.5 were sold in store no.3 in 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 dewpoint FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY units DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT dewpoint FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY units DESC LIMIT 1",
"index": 3834,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; in 2012 refers to SUBSTR(date, 1, 4) = '2012': most units sold refers to Max(units)\nWhat was the dew point on the day the most units of item no.5 were sold in store no.3 in 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 relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; when the temperature range was the biggest refers to Max(Subtract(tmax, tmin))\nHow many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.units FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T2.item_nbr = 5 ORDER BY t3.tmax - t3.tmin DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT t2.units FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T2.item_nbr = 5 ORDER BY t3.tmax - t3.tmin DESC LIMIT 1",
"index": 3835,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; when the temperature range was the biggest refers to Max(Subtract(tmax, tmin))\nHow many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest max temperature refers to Max(tmax); store no.3 refers to store_nbr = 3; in 2012 refers to substring (date, 1, 4) = '2012'; sold the best refers to Max(units); ID of the item refers to item_nbr\nWhat is the ID of the item that sold the best on the day with the highest max temperature in store no.3 in 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 T1.item_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' AND tmax = ( SELECT MAX(tmax) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' ) GROUP BY T1.item_nbr ORDER BY SUM(units) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.item_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' AND tmax = ( SELECT MAX(tmax) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' ) GROUP BY T1.item_nbr ORDER BY SUM(units) DESC LIMIT 1",
"index": 3836,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest max temperature refers to Max(tmax); store no.3 refers to store_nbr = 3; in 2012 refers to substring (date, 1, 4) = '2012'; sold the best refers to Max(units); ID of the item refers to item_nbr\nWhat is the ID of the item that sold the best on the day with the highest max temperature in store no.3 in 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 relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; highest max temperature refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012'; Percentage = Divide (Sum(units where item_nbr = 5), Sum(units)) * 100\nWhat is the percentage of the units of item no.5 sold among all units of items sold in store no.3 on the day with the highest max temperature in 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 CAST(SUM(CASE WHEN T1.item_nbr = 5 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' AND T3.tmax = ( SELECT MAX(T3.tmax) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' )",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.item_nbr = 5 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' AND T3.tmax = ( SELECT MAX(T3.tmax) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' )",
"index": 3837,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; highest max temperature refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012'; Percentage = Divide (Sum(units where item_nbr = 5), Sum(units)) * 100\nWhat is the percentage of the units of item no.5 sold among all units of items sold in store no.3 on the day with the highest max temperature in 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 sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore no. 1 refers to store_nbr = 1; on 2012/1/1 refers to date = '2012-01-01'; best seller refers to Max(units); ID refers to item_nbr\nGive the id of the bestsellers of store no.1 on 2012/1/1.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1",
"index": 3838,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore no. 1 refers to store_nbr = 1; on 2012/1/1 refers to date = '2012-01-01'; best seller refers to Max(units); ID refers to item_nbr\nGive the id of the bestsellers of store no.1 on 2012/1/1.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation no.9 refers to station_nbr = 9; on 2014/1/15 refers to date = '2014/01/15'; result wind speed refers to resultspeed\nTell the resultant wind speed of station no.9 on 2014/1/15.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT resultspeed FROM weather WHERE `date` = '2014-01-15' AND station_nbr = 9",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT resultspeed FROM weather WHERE `date` = '2014-01-15' AND station_nbr = 9",
"index": 3839,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation no.9 refers to station_nbr = 9; on 2014/1/15 refers to date = '2014/01/15'; result wind speed refers to resultspeed\nTell the resultant wind speed of station no.9 on 2014/1/15.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation with more stores refers to Max(Count(store_nbr)); ID of weather station refers to station_nbr\nGive the id of the weather station with most stores.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(station_nbr) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(station_nbr) DESC LIMIT 1",
"index": 3840,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation with more stores refers to Max(Count(store_nbr)); ID of weather station refers to station_nbr\nGive the id of the weather station with most stores.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-11-09', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-11-09', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno.21 store refers to store_nbr = 21; on 2012/11/9 refers to date = '2012-11-09'; max temperature refers to tmax\nState the max temperature of the weather station which has the no.21 store on 2012/11/9.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT tmax FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 21 AND T1.`date` = '2012-11-09'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT tmax FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 21 AND T1.`date` = '2012-11-09'",
"index": 3841,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-11-09', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-11-09', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno.21 store refers to store_nbr = 21; on 2012/11/9 refers to date = '2012-11-09'; max temperature refers to tmax\nState the max temperature of the weather station which has the no.21 store on 2012/11/9.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2014-02-21', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2014-02-21', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n dewpoint integer, -- example: [36, 26]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore no. 30 refers to store_nbr = 30; on 2014/2/21 refers to date = '2014-02-21'\nProvide the sunrise time recorded by the home weather station of store no.30 on 2014/2/21.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.sunrise FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2014-02-21' AND store_nbr = 30",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.sunrise FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2014-02-21' AND store_nbr = 30",
"index": 3842,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2014-02-21', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2014-02-21', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n dewpoint integer, -- example: [36, 26]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore no. 30 refers to store_nbr = 30; on 2014/2/21 refers to date = '2014-02-21'\nProvide the sunrise time recorded by the home weather station of store no.30 on 2014/2/21.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2013-02-12', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2013-02-12', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno.2 store refers to store_nbr = 2; on 2013/2/12 refers to date = '2013-02-12'; code summarization refers to codesum\nProvide the code summarization for the weather recorded by the weather station which contained the no.2 store on 2013/2/12.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.codesum FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2013-02-12' AND T2.store_nbr = 2",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.codesum FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2013-02-12' AND T2.store_nbr = 2",
"index": 3843,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2013-02-12', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2013-02-12', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno.2 store refers to store_nbr = 2; on 2013/2/12 refers to date = '2013-02-12'; code summarization refers to codesum\nProvide the code summarization for the weather recorded by the weather station which contained the no.2 store on 2013/2/12.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-12-25', '2012-01-01', '2012-01-02']\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n heat integer, -- example: [23, 24]\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore no.2 refers to store_nbr = 2; on 2012/12/25 refers to date = '2012-12-25'; total precipitation refers to preciptotal\nHow many inches of total precipitation was recorded by the weather station of store no.2 on 2012/12/25?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.preciptotal FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2012-12-25' AND T2.store_nbr = 2",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.preciptotal FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2012-12-25' AND T2.store_nbr = 2",
"index": 3844,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-12-25', '2012-01-01', '2012-01-02']\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n heat integer, -- example: [23, 24]\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore no.2 refers to store_nbr = 2; on 2012/12/25 refers to date = '2012-12-25'; total precipitation refers to preciptotal\nHow many inches of total precipitation was recorded by the weather station of store no.2 on 2012/12/25?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of store refers to store_nbr; highest number of store refers to Max(Count(store_nbr)); weather station refers to station_nbr\nWhich weather station has the highest number of stores?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1",
"index": 3845,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of store refers to store_nbr; highest number of store refers to Max(Count(store_nbr)); weather station refers to station_nbr\nWhich weather station has the highest number of stores?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin March 2014 refers to substring (date, 1, 4) = '2014' and substring (date, 6, 2) = '03'; temperature is below the 30-year normal refers to depart < 0; highest number of days refers to Max(Count(date))\nIn March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT station_nbr FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr HAVING COUNT(DISTINCT `date`) = ( SELECT COUNT(DISTINCT `date`) FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr ORDER BY COUNT(`date`) DESC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT station_nbr FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr HAVING COUNT(DISTINCT `date`) = ( SELECT COUNT(DISTINCT `date`) FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr ORDER BY COUNT(`date`) DESC LIMIT 1 )",
"index": 3846,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin March 2014 refers to substring (date, 1, 4) = '2014' and substring (date, 6, 2) = '03'; temperature is below the 30-year normal refers to depart < 0; highest number of days refers to Max(Count(date))\nIn March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultdir integer, -- resultant direction, example: [20, 24]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem 9 refers to item_nbr = 9; sold the highest quantity refers to Max(Sum(units)); weather station refers to station_nbr\nWhich weather station does the store that sold the highest quantity of item 9 belongs to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.item_nbr = 9 GROUP BY T2.station_nbr ORDER BY SUM(T1.units) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.item_nbr = 9 GROUP BY T2.station_nbr ORDER BY SUM(T1.units) DESC LIMIT 1",
"index": 3847,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultdir integer, -- resultant direction, example: [20, 24]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem 9 refers to item_nbr = 9; sold the highest quantity refers to Max(Sum(units)); weather station refers to station_nbr\nWhich weather station does the store that sold the highest quantity of item 9 belongs to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost windy station refers to Max(avgspeed)\nHow many stores belong to the most windy station?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(store_nbr) FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT COUNT(store_nbr) FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1 )",
"index": 3848,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost windy station refers to Max(avgspeed)\nHow many stores belong to the most windy station?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweather station 14 refers to station_nbr = 14; February 2014 refers to substring (date, 1, 7) = '2014-02' ; sold no less than 300 quantities refers to units > = 300; item no.44 refers to item_nbr = 44; store refers to store_nbr\nAmong the stores in weather station 14 in February 2014, which store had sold no less than 300 quantities for item number 44 in a single day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.store_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.station_nbr = 14 AND T1.`date` LIKE '%2014-02%' AND T1.item_nbr = 44 AND units >= 300",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.store_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.station_nbr = 14 AND T1.`date` LIKE '%2014-02%' AND T1.item_nbr = 44 AND units >= 300",
"index": 3849,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweather station 14 refers to station_nbr = 14; February 2014 refers to substring (date, 1, 7) = '2014-02' ; sold no less than 300 quantities refers to units > = 300; item no.44 refers to item_nbr = 44; store refers to store_nbr\nAmong the stores in weather station 14 in February 2014, which store had sold no less than 300 quantities for item number 44 in a single day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin February 2012 refers to SUBSTR(date, 1, 7) = '2012-02'; earliest sunrise Min(sunrise); station with no more than 1 store refers to station_nbr where Count(store_nbr) = 1\nWhat is the earliest sunrise recorded in the stations with no more than 1 store in February 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 T1.station_nbr FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE sunrise IS NOT NULL AND T2.`date` LIKE '%2012-02%' AND T1.station_nbr IN ( SELECT station_nbr FROM relation GROUP BY station_nbr HAVING COUNT(store_nbr) = 1 ) ORDER BY sunrise LIMIT 1",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.station_nbr FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE sunrise IS NOT NULL AND T2.`date` LIKE '%2012-02%' AND T1.station_nbr IN ( SELECT station_nbr FROM relation GROUP BY station_nbr HAVING COUNT(store_nbr) = 1 ) ORDER BY sunrise LIMIT 1",
"index": 3850,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin February 2012 refers to SUBSTR(date, 1, 7) = '2012-02'; earliest sunrise Min(sunrise); station with no more than 1 store refers to station_nbr where Count(store_nbr) = 1\nWhat is the earliest sunrise recorded in the stations with no more than 1 store in February 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 relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quantity refers to Max(units); station refers to station_nbr\nWhat are the top 3 stations that have sold the highest quantities for an item in a single day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr ORDER BY T1.units DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T2.station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr ORDER BY T1.units DESC LIMIT 3",
"index": 3851,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quantity refers to Max(units); station refers to station_nbr\nWhat are the top 3 stations that have sold the highest quantities for an item in a single day?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2014-02-08', '2014-02-01', '2014-02-02', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2014-02-08', '2014-02-02', '2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOn February 8, 2014 refers to date = '2014-02-08'; store 29 refers to store_nbr = 29; minimum temperature refers to tmin; station refers to station_nbr\nOn February 8, 2014, what is the minimum temperature in the station where store 29 belongs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT tmin FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.store_nbr = 29 AND T2.`date` = '2014-02-08'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT tmin FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.store_nbr = 29 AND T2.`date` = '2014-02-08'",
"index": 3852,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2014-02-08', '2014-02-01', '2014-02-02', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2014-02-08', '2014-02-02', '2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOn February 8, 2014 refers to date = '2014-02-08'; store 29 refers to store_nbr = 29; minimum temperature refers to tmin; station refers to station_nbr\nOn February 8, 2014, what is the minimum temperature in the station where store 29 belongs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation with highest number of stores refers to station_nbr where Max(Count(store_nbr)); station refers to station_nbr; in February 2012 refers to substring (date, 1, 7) = '2012-02'; average maximum temperature = Divide(Sum(tmax), 29)\nWhich station has the highest number of stores? Calculate the said station's average maximum temperature in February 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 CAST(SUM(T2.tmax) AS REAL) / 29 FROM ( SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1 ) AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE SUBSTR(T2.`date`, 1, 7) = '2012-02'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT CAST(SUM(T2.tmax) AS REAL) / 29 FROM ( SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1 ) AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE SUBSTR(T2.`date`, 1, 7) = '2012-02'",
"index": 3853,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation with highest number of stores refers to station_nbr where Max(Count(store_nbr)); station refers to station_nbr; in February 2012 refers to substring (date, 1, 7) = '2012-02'; average maximum temperature = Divide(Sum(tmax), 29)\nWhich station has the highest number of stores? Calculate the said station's average maximum temperature in February 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 relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweather station 12 refers to station_nbr = 12; item 5 refers to item_nbr = 5; 10 store refers to store_nbr = 10; in 2014 refers to SUBSTR(date, 1, 4) = '2014'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100\nBetween the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE station_nbr = 12 AND item_nbr = 5 AND T2.`date` LIKE '%2014%'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE station_nbr = 12 AND item_nbr = 5 AND T2.`date` LIKE '%2014%'",
"index": 3854,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweather station 12 refers to station_nbr = 12; item 5 refers to item_nbr = 5; 10 store refers to store_nbr = 10; in 2014 refers to SUBSTR(date, 1, 4) = '2014'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100\nBetween the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmaximum average speed refers to Max(avgspeed)\nWhat is the maximum average speed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(avgspeed) FROM weather",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT MAX(avgspeed) FROM weather",
"index": 3855,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmaximum average speed refers to Max(avgspeed)\nWhat is the maximum average speed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nminimum dew point refers to Min(dewpoint)\nWhat is the minimum dew point?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MIN(dewpoint) FROM weather",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT MIN(dewpoint) FROM weather",
"index": 3856,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nminimum dew point refers to Min(dewpoint)\nWhat is the minimum dew point?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-15', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-15', '2012-01-11', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation number 1 refers to station_nbr = 1 ; minimum temperature = tmin; maximum temperature = tmax; on 15 January 2012 refers to date = '2012-01-15'\nWhat is the maximum and minimum temperature for station number 1 on 15 January 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 tmax, tmin FROM weather WHERE station_nbr = 1 AND `date` = '2012-01-15'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT tmax, tmin FROM weather WHERE station_nbr = 1 AND `date` = '2012-01-15'",
"index": 3857,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-15', '2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n codesum text, -- code summarization, example: ['RA FZFG BR', ' ']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-15', '2012-01-11', '2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation number 1 refers to station_nbr = 1 ; minimum temperature = tmin; maximum temperature = tmax; on 15 January 2012 refers to date = '2012-01-15'\nWhat is the maximum and minimum temperature for station number 1 on 15 January 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 relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n wetbulb integer, -- example: [40, 35]\n codesum text, -- code summarization, example: ['HZ', 'RA FZFG BR', ' ']\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore 35 refers to store_nbr = 35; haze is recorded refers to codesum like '%'||'HZ'||'%'\nList out dates when haze is recorded in store 35.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.`date` FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 35 AND T1.codesum LIKE '%' OR 'HZ' OR '%'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.`date` FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 35 AND T1.codesum LIKE '%' OR 'HZ' OR '%'",
"index": 3858,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n wetbulb integer, -- example: [40, 35]\n codesum text, -- code summarization, example: ['HZ', 'RA FZFG BR', ' ']\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore 35 refers to store_nbr = 35; haze is recorded refers to codesum like '%'||'HZ'||'%'\nList out dates when haze is recorded in store 35.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tavg integer, -- temperature average, example: [42, 41]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore number 3 refers to store_nbr = 3; average speed refers to avgspeed; store number 4 refers to store_nbr = 4\nWhat is the sea level and average speed for store number 3 and store number 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.sealevel, T1.avgspeed FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 3 OR T2.store_nbr = 4",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT T1.sealevel, T1.avgspeed FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 3 OR T2.store_nbr = 4",
"index": 3859,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tavg integer, -- temperature average, example: [42, 41]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore number 3 refers to store_nbr = 3; average speed refers to avgspeed; store number 4 refers to store_nbr = 4\nWhat is the sea level and average speed for store number 3 and store number 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 relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tavg integer, -- temperature average, example: [42, 41]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation 1 refers to station_nbr = 1; station 2 refers to station_nbr = 2; on year 2012 refers to substring (date, 1, 4) = '2012'; difference = Subtract (Sum(units where station_nbr = 1), Sum(units where station_nbr = 2))\nWhat was the difference of number of units sold in station number 1 and number 2 on year 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 SUM(CASE WHEN T1.station_nbr = 1 THEN units ELSE 0 END) - SUM(CASE WHEN T1.station_nbr = 2 THEN units ELSE 0 END) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.`date` LIKE '%2012%'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.station_nbr = 1 THEN units ELSE 0 END) - SUM(CASE WHEN T1.station_nbr = 2 THEN units ELSE 0 END) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.`date` LIKE '%2012%'",
"index": 3860,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tavg integer, -- temperature average, example: [42, 41]\n heat integer, -- example: [23, 24]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n sunset text, -- example: ['16:26:00', '16:27:00']\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstation 1 refers to station_nbr = 1; station 2 refers to station_nbr = 2; on year 2012 refers to substring (date, 1, 4) = '2012'; difference = Subtract (Sum(units where station_nbr = 1), Sum(units where station_nbr = 2))\nWhat was the difference of number of units sold in station number 1 and number 2 on year 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 sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n snowfall real, -- example: [0.0, 0.05]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore number 18 refers to store_nbr = 18; store number 19 refers to store_nbr = 19; on 16 September 2022 refers to date = '2022-09-16'; average temperature difference = Subtract(tavg where store_nbr = 18, tavg where store_nbr = 19)\nWhat was the average temperature difference between store number 18 and 19 on 16 September 2022?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.store_nbr = 18 THEN T2.tavg ELSE 0 END) - SUM(CASE WHEN T1.store_nbr = 19 THEN T2.tavg ELSE 0 END) FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.`date` = '2012-09-16'",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.store_nbr = 18 THEN T2.tavg ELSE 0 END) - SUM(CASE WHEN T1.store_nbr = 19 THEN T2.tavg ELSE 0 END) FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.`date` = '2012-09-16'",
"index": 3861,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n depart integer, -- departure from normal, example: [16, 12]\n heat integer, -- example: [23, 24]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n snowfall real, -- example: [0.0, 0.05]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore number 18 refers to store_nbr = 18; store number 19 refers to store_nbr = 19; on 16 September 2022 refers to date = '2022-09-16'; average temperature difference = Subtract(tavg where store_nbr = 18, tavg where store_nbr = 19)\nWhat was the average temperature difference between store number 18 and 19 on 16 September 2022?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem 1 refers to item_nbr = 1; when the average temperature is 83 refers to tavg = 83\nHow many units are being sold for item 1 when the average temperature is 83?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(units) FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 1 AND T1.tavg = 83",
"style": "rule"
} | {
"db_id": "sales_in_weather.sqlite",
"gt_sql": "SELECT SUM(units) FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 1 AND T1.tavg = 83",
"index": 3862,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales_in_weather (\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n store_nbr integer, -- store number, example: [1, 2]\n item_nbr integer, -- item number, example: [1, 2]\n units integer, -- example: [0, 29]\n PRIMARY KEY (`date`, store_nbr, item_nbr)\n);\n\nCREATE TABLE weather (\n station_nbr integer, -- station number, example: [1, 2]\n `date` date, -- example: ['2012-01-01', '2012-01-02']\n tmax integer, -- temperature max, example: [52, 50]\n tmin integer, -- temperature min, example: [31, 11]\n tavg integer, -- temperature average, example: [42, 41]\n dewpoint integer, -- example: [36, 26]\n wetbulb integer, -- example: [40, 35]\n cool integer, -- example: [0, 5]\n sunrise text, -- example: ['07:16:00', '07:15:00']\n snowfall real, -- example: [0.0, 0.05]\n preciptotal real, -- example: [0.05, 0.01]\n stnpressure real, -- station pressure, example: [29.78, 29.44]\n sealevel real, -- example: [29.92, 29.62]\n resultspeed real, -- resultant speed, example: [3.6, 9.8]\n resultdir integer, -- resultant direction, example: [20, 24]\n avgspeed real, -- average speed, example: [4.6, 10.3]\n PRIMARY KEY (station_nbr, `date`)\n);\n\nCREATE TABLE relation (\n store_nbr integer, -- store number, example: [1, 2]\n station_nbr integer, -- station number, example: [1, 14]\n PRIMARY KEY (store_nbr),\n CONSTRAINT fk_relation_store_nbr FOREIGN KEY (store_nbr) REFERENCES sales_in_weather (store_nbr),\n CONSTRAINT fk_relation_station_nbr FOREIGN KEY (station_nbr) REFERENCES weather (station_nbr)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nitem 1 refers to item_nbr = 1; when the average temperature is 83 refers to tavg = 83\nHow many units are being sold for item 1 when the average temperature is 83?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['republic', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\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:\nCalculate the percentage of country which gained independence as republic after 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Government = 'republic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics WHERE STRFTIME('%Y', Independence) > '1970'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN Government = 'republic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics WHERE STRFTIME('%Y', Independence) > '1970'",
"index": 3863,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['republic', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\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:\nCalculate the percentage of country which gained independence as republic after 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\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:\nState the country and its population with population growth greater than 2% but infant mortality rate less than 5%.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Name, T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Population_Growth > 2 AND T2.Infant_Mortality < 5",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name, T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Population_Growth > 2 AND T2.Infant_Mortality < 5",
"index": 3864,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\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:\nState the country and its population with population growth greater than 2% but infant mortality rate less than 5%.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich is the majority of the ethnic group in country with great than 10,000,000 population\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Population > 10000000 GROUP BY T2.Name, T2.Percentage ORDER BY T2.Percentage DESC LIMIT 2",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Population > 10000000 GROUP BY T2.Name, T2.Percentage ORDER BY T2.Percentage DESC LIMIT 2",
"index": 3865,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich is the majority of the ethnic group in country with great than 10,000,000 population\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage = 100 means 100% of the population\nWhat is the full name of the country with 100% Africans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Percentage = 100 AND T1.Name = 'African'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Percentage = 100 AND T1.Name = 'African'",
"index": 3866,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage = 100 means 100% of the population\nWhat is the full name of the country with 100% Africans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\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:\nFor country with area greater than 600000, what is agriculture percentage of GDP the country contributes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Agriculture FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Area > 600000 AND T2.Agriculture IS NOT NULL",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Agriculture FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Area > 600000 AND T2.Agriculture IS NOT NULL",
"index": 3867,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\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:\nFor country with area greater than 600000, what is agriculture percentage of GDP the country contributes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'republic', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the country with republic government which has the highest population growth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Country FROM population AS T1 INNER JOIN politics AS T2 ON T1.Country = T2.Country WHERE T2.Government = 'republic' ORDER BY T1.Population_Growth DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Country FROM population AS T1 INNER JOIN politics AS T2 ON T1.Country = T2.Country WHERE T2.Government = 'republic' ORDER BY T1.Population_Growth DESC LIMIT 1",
"index": 3868,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'republic', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the country with republic government which has the highest population growth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Bulgaria', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Bulgaria', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Bulgaria', 'Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Bulgaria', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Bulgaria', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Bulgaria', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhen did 'Bulgaria' gain independence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Bulgaria'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Bulgaria'",
"index": 3869,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Bulgaria', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Bulgaria', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Bulgaria', 'Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Bulgaria', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Bulgaria', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Bulgaria', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhen did 'Bulgaria' gain independence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Arab', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArab is the name of enthic groups in the country; Population of (Arab in each country) = (percentage of Arab) * (population of each country)\nCalculate the population of Arab in each country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Percentage * T1.Population FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Arab'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Percentage * T1.Population FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Arab'",
"index": 3870,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Arab', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArab is the name of enthic groups in the country; Population of (Arab in each country) = (percentage of Arab) * (population of each country)\nCalculate the population of Arab in each country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGrowth population = population_growth * population\nWhat is the number of growth population for country with the lowest infant mortality?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Population_Growth * T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Infant_Mortality IS NOT NULL ORDER BY T2.Infant_Mortality ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Population_Growth * T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Infant_Mortality IS NOT NULL ORDER BY T2.Infant_Mortality ASC LIMIT 1",
"index": 3871,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGrowth population = population_growth * population\nWhat is the number of growth population for country with the lowest infant mortality?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\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:\nAmong countries with more than 400,000 GDP, state its capital and population.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Capital, T1.Population FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.GDP > 400000",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Capital, T1.Population FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.GDP > 400000",
"index": 3872,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\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:\nAmong countries with more than 400,000 GDP, state its capital and population.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the highest infant mortality? Also state its population growth.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.Population_Growth FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country ORDER BY T2.Infant_Mortality DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name, T2.Population_Growth FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country ORDER BY T2.Infant_Mortality DESC LIMIT 1",
"index": 3873,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the highest infant mortality? Also state its population growth.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPopulation_growth = 3 means 3% population growth rate\nAmong the countries with more than 3% population growth rate, state the country name in full along with its GDP.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T3.GDP FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T2.Country WHERE T2.Population_Growth > 3",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name, T3.GDP FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T2.Country WHERE T2.Population_Growth > 3",
"index": 3874,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPopulation_growth = 3 means 3% population growth rate\nAmong the countries with more than 3% population growth rate, state the country name in full along with its GDP.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list the name of the countries with over 5 ethnic groups.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name HAVING COUNT(T1.Name) > 5",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name HAVING COUNT(T1.Name) > 5",
"index": 3875,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list the name of the countries with over 5 ethnic groups.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the highest GDP?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC LIMIT 1",
"index": 3876,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the highest GDP?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the countries with a population of over 10000000, how many of them have a GDP of over 500000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.GDP > 500000 AND T1.Population > 10000000",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(T1.Name) FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.GDP > 500000 AND T1.Population > 10000000",
"index": 3877,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the countries with a population of over 10000000, how many of them have a GDP of over 500000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the lowest inflation rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Inflation IS NOT NULL ORDER BY T2.Inflation ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Inflation IS NOT NULL ORDER BY T2.Inflation ASC LIMIT 1",
"index": 3878,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the lowest inflation rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\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:\nAmong the countries whose agriculture percentage of the GDP is under 50%, how many of them have an area of over 8000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Agriculture < 50 AND T1.Area > 8000000",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(T1.Name) FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Agriculture < 50 AND T1.Area > 8000000",
"index": 3879,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\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:\nAmong the countries whose agriculture percentage of the GDP is under 50%, how many of them have an area of over 8000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe lake with the highest altitude is located in which city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.City FROM lake AS T1 LEFT JOIN located AS T2 ON T2.Lake = T1.Name ORDER BY T1.Altitude DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.City FROM lake AS T1 LEFT JOIN located AS T2 ON T2.Lake = T1.Name ORDER BY T1.Altitude DESC LIMIT 1",
"index": 3880,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe lake with the highest altitude is located in which city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Canary Islands', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Canary Islands', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Canary Islands', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Canary Islands', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Canary Islands', 'Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Canary Islands', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Canary Islands', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, 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 lakes in the Canary Islands cover an area of over 1000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T1.Province = 'Canary Islands' AND T2.Area > 1000000",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(T2.Name) FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T1.Province = 'Canary Islands' AND T2.Area > 1000000",
"index": 3881,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Canary Islands', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Canary Islands', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Canary Islands', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Canary Islands', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Canary Islands', 'Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Canary Islands', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Canary Islands', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, 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 lakes in the Canary Islands cover an area of over 1000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the most languages spoken?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1",
"index": 3882,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the most languages spoken?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['America', 'Africa']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Armenian', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['America', 'Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Armenian', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, 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 of country > 90% refers to percentage > 90; America is one of country names\nWhat is the capital city of the country that has the percentage of Armenian speakers over 90%?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Capital FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Armenian' AND T2.Percentage > 90",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Capital FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Armenian' AND T2.Percentage > 90",
"index": 3883,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['America', 'Africa']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Armenian', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['America', 'Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Armenian', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, 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 of country > 90% refers to percentage > 90; America is one of country names\nWhat is the capital city of the country that has the percentage of Armenian speakers over 90%?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\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 organizations are founded in countries with a population of under 1000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000",
"index": 3884,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\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 organizations are founded in countries with a population of under 1000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\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 organizations are established in the country with the most ethnic groups?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Province) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN ethnicGroup AS T3 ON T3.Country = T2.Country GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(T2.Province) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN ethnicGroup AS T3 ON T3.Country = T2.Country GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1",
"index": 3885,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\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 organizations are established in the country with the most ethnic groups?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Dutch', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Dutch', 'Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDutch is one of language\nPlease list the organization names established in the countries where Dutch is spoken.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Dutch'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Name FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Dutch'",
"index": 3886,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Dutch', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Dutch', 'Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDutch is one of language\nPlease list the organization names established in the countries where Dutch is spoken.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Bosnian', 'Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Length real, -- example: [288.0, 313.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBosnian is one of language\nHow many organizations are established in countries where people speak Bosnian?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Bosnian'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(T2.Name) FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Bosnian'",
"index": 3887,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Bosnian', 'Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Length real, -- example: [288.0, 313.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBosnian is one of language\nHow many organizations are established in countries where people speak Bosnian?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLake area coverage = [sum(area of the lakes in the country) / (area of the country)] * 100%\nWhat is the highest lake area coverage of a country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Area * 100 / T3.Area FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country ORDER BY T2.Longitude DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Area * 100 / T3.Area FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country ORDER BY T2.Longitude DESC LIMIT 1",
"index": 3888,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLake area coverage = [sum(area of the lakes in the country) / (area of the country)] * 100%\nWhat is the highest lake area coverage of a country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAverage inflation rate = [sum(inflation) / count(countries)]; 30% above average implies inflation > 1.3 average inflation rate\nPlease list the names of the countries with an inflation rate that's 30% above the average.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T2.Inflation HAVING T2.Inflation > AVG(T2.Inflation) * 1.3",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T2.Inflation HAVING T2.Inflation > AVG(T2.Inflation) * 1.3",
"index": 3889,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAverage inflation rate = [sum(inflation) / count(countries)]; 30% above average implies inflation > 1.3 average inflation rate\nPlease list the names of the countries with an inflation rate that's 30% above the average.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Detroit', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['Detroit River', 'River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Detroit River', 'Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Detroit River', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Detroit River', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Detroit', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Detroit River', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Detroit River', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich two countries does the Detroit River flow through? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.Name FROM located AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country WHERE T2.Name = 'Detroit River'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T3.Name FROM located AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country WHERE T2.Name = 'Detroit River'",
"index": 3890,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Detroit', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['Detroit River', 'River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Detroit River', 'Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Detroit River', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Detroit River', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Detroit', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Detroit River', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Detroit River', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich two countries does the Detroit River flow through? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\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:\nWhich two countries have the longest border in the world? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Country1, T2.Country2 FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 ORDER BY T2.Length DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Country1, T2.Country2 FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 ORDER BY T2.Length DESC LIMIT 1",
"index": 3891,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\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:\nWhich two countries have the longest border in the world? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Indonesia', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Indonesia', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Indonesia', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Indonesia', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Indonesia', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Indonesia', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Indonesia', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Indonesia', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Indonesia', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Indonesia', 'Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndonesia refers to one of countries\nHow many mountains are there in Indonesia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Indonesia'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Indonesia'",
"index": 3892,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Indonesia', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Indonesia', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Indonesia', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Indonesia', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Indonesia', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Indonesia', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Indonesia', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Indonesia', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Indonesia', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Indonesia', 'Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndonesia refers to one of countries\nHow many mountains are there in Indonesia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Japan', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJapan is one of country names\nWhat is the quantity of the mountains does Japan have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan'",
"index": 3893,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Japan', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJapan is one of country names\nWhat is the quantity of the mountains does Japan have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the latitude of the island on which Mount Andrinjitra is located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Latitude FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island WHERE T2.Mountain = 'Andringitra'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Latitude FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island WHERE T2.Mountain = 'Andringitra'",
"index": 3894,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the latitude of the island on which Mount Andrinjitra is located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich two countries share the second highest mountain? Give the country code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Code FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T2.Mountain = ( SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1, 1 )",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Code FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T2.Mountain = ( SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1, 1 )",
"index": 3895,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich two countries share the second highest mountain? Give the country code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Egypt', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the area of Egypt as a percentage of Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Percentage FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Percentage FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt'",
"index": 3896,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Egypt', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the area of Egypt as a percentage of Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Egypt', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the area of Egypt as a percentage of Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Area * 100 / T3.Area FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Area * 100 / T3.Area FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt'",
"index": 3897,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Egypt', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the area of Egypt as a percentage of Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n Name text, -- example: ['Japan', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost people refers to largest population\nWhich city in Japan has the most people in the country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan' ORDER BY T2.Population DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T2.Name FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan' ORDER BY T2.Population DESC LIMIT 1",
"index": 3898,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n Name text, -- example: ['Japan', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost people refers to largest population\nWhich city in Japan has the most people in the country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Olsztyn', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Olsztyn', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOlsztyn is one of country names\nFor the country in which Olsztyn is located, where is the capital?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Capital FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Olsztyn'",
"style": "rule"
} | {
"db_id": "mondial_geo.sqlite",
"gt_sql": "SELECT T1.Capital FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Olsztyn'",
"index": 3899,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Olsztyn', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Olsztyn', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOlsztyn is one of country names\nFor the country in which Olsztyn is located, where is the capital?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.