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 biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['corpus', 'title', 'refer', 'words', 'titl', 'what']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Corpus', 'Title', 'Word', 'Most', 'Max', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost words refers to max(words)\nWhat is the title of corpus with most words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM pages WHERE words = ( SELECT MAX(words) FROM pages )", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT title FROM pages WHERE words = ( SELECT MAX(words) FROM pages )", "index": 2800, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['corpus', 'title', 'refer', 'words', 'titl', 'what']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Corpus', 'Title', 'Word', 'Most', 'Max', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost words refers to max(words)\nWhat is the title of corpus with most words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['revision', 'titles', 'single', 'title', 'among', 'refer']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Single', 'Title', 'Down', 'Word', 'ID', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsingle digit word count refers to words < 10\nAmong the title with single digit word count, list down 5 revision page ID of these titles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT revision FROM pages WHERE words < 10 LIMIT 5", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT revision FROM pages WHERE words < 10 LIMIT 5", "index": 2801, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['revision', 'titles', 'single', 'title', 'among', 'refer']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Single', 'Title', 'Down', 'Word', 'ID', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsingle digit word count refers to words < 10\nAmong the title with single digit word count, list down 5 revision page ID of these titles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Desena', 'Corpus', 'Title', 'Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appear', 'desena', 'corpus', 'where', 'title', 'word']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThis is not\nWhat is the title of corpus where word \"desena\" appear?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.title FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid INNER JOIN words AS T3 ON T2.wid = T3.wid WHERE T3.word = 'desena'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.title FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid INNER JOIN words AS T3 ON T2.wid = T3.wid WHERE T3.word = 'desena'", "index": 2802, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Desena', 'Corpus', 'Title', 'Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appear', 'desena', 'corpus', 'where', 'title', 'word']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThis is not\nWhat is the title of corpus where word \"desena\" appear?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['animal', 'title', 'refer', 'anim', 'titl', 'word']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Animals', 'Animal', 'Title', 'Word', 'ID', 'The Words']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword id \"88\" refers to wid = 88\nIs word id \"88\" the word id for title \"Animals\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 COUNT(T1.pid) > 0 THEN 'YES' ELSE 'NO' END AS YORN FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.wid = 88 AND T1.title = 'Animals'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CASE WHEN COUNT(T1.pid) > 0 THEN 'YES' ELSE 'NO' END AS YORN FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.wid = 88 AND T1.title = 'Animals'", "index": 2803, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['animal', 'title', 'refer', 'anim', 'titl', 'word']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Animals', 'Animal', 'Title', 'Word', 'ID', 'The Words']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword id \"88\" refers to wid = 88\nIs word id \"88\" the word id for title \"Animals\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['The Words', 'Down', 'Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['paired', 'words', 'refer', 'paire', 'them', 'down']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npair with \"John\" refers to w1st.word = \"John\" or w2nd.word = \"John\"\nWhat are the words that were paired with \"John\", list down 10 of them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT w2nd FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'john' ) LIMIT 10", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT w2nd FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'john' ) LIMIT 10", "index": 2804, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['The Words', 'Down', 'Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['paired', 'words', 'refer', 'paire', 'them', 'down']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npair with \"John\" refers to w1st.word = \"John\" or w2nd.word = \"John\"\nWhat are the words that were paired with \"John\", list down 10 of them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Title', 'Fresc', 'Down', 'Word', 'PID', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['revision', 'appears', 'appear', 'titles', 'where', 'title']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage id refers to pid; \"fresc\" refers to word = 'fresc'\nList down the revision page id of titles where \"fresc\" appears.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.revision FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'fresc'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T3.revision FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'fresc'", "index": 2805, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Title', 'Fresc', 'Down', 'Word', 'PID', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['revision', 'appears', 'appear', 'titles', 'where', 'title']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage id refers to pid; \"fresc\" refers to word = 'fresc'\nList down the revision page id of titles where \"fresc\" appears.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['between', 'paired', 'paire', 'write', 'refer', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword id from 1 to 10 refers to wid BETWEEN 1 AND 10\nList down the words with word id from 1 to 10 and write down a paired word for each of them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.word AS W1, T3.word AS W2 FROM words AS T1 LEFT JOIN biwords AS T2 ON T1.wid = T2.w1st LEFT JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.wid <= 10 GROUP BY T1.wid", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.word AS W1, T3.word AS W2 FROM words AS T1 LEFT JOIN biwords AS T2 ON T1.wid = T2.w1st LEFT JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.wid <= 10 GROUP BY T1.wid", "index": 2806, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['between', 'paired', 'paire', 'write', 'refer', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword id from 1 to 10 refers to wid BETWEEN 1 AND 10\nList down the words with word id from 1 to 10 and write down a paired word for each of them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Times', 'Word', 'TiME', 'TIME', 'Time', 'Most']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'indicate', 'repeated', 'repeat', 'which']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepeated the most times refer to MAX(occurrences);\nIndicate which is the word that is repeated the most times.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT word FROM words WHERE occurrences = ( SELECT MAX(occurrences) FROM words )", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT word FROM words WHERE occurrences = ( SELECT MAX(occurrences) FROM words )", "index": 2807, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Times', 'Word', 'TiME', 'TIME', 'Time', 'Most']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'indicate', 'repeated', 'repeat', 'which']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepeated the most times refer to MAX(occurrences);\nIndicate which is the word that is repeated the most times.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Title', 'Word', 'Min', 'Ha', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['title', 'count', 'refer', 'words', 'page', 'titl']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas the fewest words refers to MIN(COUNT(words));\nWhat is the title of the page that has the fewest words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM pages WHERE title = ( SELECT MIN(words) FROM pages )", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT title FROM pages WHERE title = ( SELECT MIN(words) FROM pages )", "index": 2808, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Title', 'Word', 'Min', 'Ha', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['title', 'count', 'refer', 'words', 'page', 'titl']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas the fewest words refers to MIN(COUNT(words));\nWhat is the title of the page that has the fewest words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'composed', 'letters', 'exactly', 'compose']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthree-letter words are words composed of exactly three letters;\nHow many total occurrences are there in the three-letter words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(occurrences) FROM words WHERE LENGTH(word) = 3", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT SUM(occurrences) FROM words WHERE LENGTH(word) = 3", "index": 2809, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'composed', 'letters', 'exactly', 'compose']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthree-letter words are words composed of exactly three letters;\nHow many total occurrences are there in the three-letter words?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['percentage', 'different', 'calculate', 'average', 'begins', 'appear']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Pages', 'Title', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(words WHERE title = 'A%'), COUNT(words WHERE title = 'A%')) as percentage; A is a letter;\nCalculate the average number of different words that appear on all pages whose title begins with A.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(words) FROM pages WHERE title LIKE 'A%'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT AVG(words) FROM pages WHERE title LIKE 'A%'", "index": 2810, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['percentage', 'different', 'calculate', 'average', 'begins', 'appear']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Pages', 'Title', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(words WHERE title = 'A%'), COUNT(words WHERE title = 'A%')) as percentage; A is a letter;\nCalculate the average number of different words that appear on all pages whose title begins with A.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'repetitions', 'occurrence', 'repetition', 'calculate']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; the first word id number 34 refers to w1st = 34; repetition refers to occurrences or times this pair appears; DIVIDE(SUM(occurrences where w1st = 34), COUNT(occurrences where w1st = 34));\nCalculate the average number of repetitions in the pairs of words in which the first word id is number 34.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 w1st = 34 THEN 1 ELSE 0 END) AS REAL) / COUNT(w1st) FROM biwords", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN w1st = 34 THEN 1 ELSE 0 END) AS REAL) / COUNT(w1st) FROM biwords", "index": 2811, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'repetitions', 'occurrence', 'repetition', 'calculate']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; the first word id number 34 refers to w1st = 34; repetition refers to occurrences or times this pair appears; DIVIDE(SUM(occurrences where w1st = 34), COUNT(occurrences where w1st = 34));\nCalculate the average number of repetitions in the pairs of words in which the first word id is number 34.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['percentage', 'different', 'calculate', 'differ', 'calcul', 'divide']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(pages WHERE words = 1500), COUNT(pages)) as percentage;\nCalculate the percentage of pages that have 1500 different words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(CASE WHEN words = 1500 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(page) FROM pages WHERE words > 300 LIMIT 3", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN words = 1500 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(page) FROM pages WHERE words > 300 LIMIT 3", "index": 2812, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['percentage', 'different', 'calculate', 'differ', 'calcul', 'divide']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(pages WHERE words = 1500), COUNT(pages)) as percentage;\nCalculate the percentage of pages that have 1500 different words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'percentage', 'occurrence', 'calculate', 'appears']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; the same word appears in a pair refers to w1st = w2nd; times refers to occurrences; DIVIDE(COUNT(occurrences where w1st = w2nd), COUNT(occurrences)) as percentage;\nCalculate the percentage of times that the same word appears in a pair.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(CASE WHEN w1st = w2nd THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(w1st) FROM biwords", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN w1st = w2nd THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(w1st) FROM biwords", "index": 2813, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'percentage', 'occurrence', 'calculate', 'appears']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; the same word appears in a pair refers to w1st = w2nd; times refers to occurrences; DIVIDE(COUNT(occurrences where w1st = w2nd), COUNT(occurrences)) as percentage;\nCalculate the percentage of times that the same word appears in a pair.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'indicate', 'fukunaga', \"d'egees\", 'formed', \"d'egee\"]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['The Words', 'Second', 'First', 'Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word;  w1st = word = 'fukunaga' or w2nd = word = 'fukunaga'; w1st = word = 'd'egees'or w2nd = word = 'd'egees';\nIndicate if there is any pair formed by the words fukunaga and d'egees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 COUNT(T1.wid) > 0 THEN 'yes' ELSE 'no' END FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st OR T1.wid = T2.w2nd WHERE T2.w1st = ( SELECT wid FROM words WHERE T1.word = 'fukunaga' ) AND T2.w2nd = ( SELECT wid FROM words WHERE word LIKE 'd%egees' )", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CASE WHEN COUNT(T1.wid) > 0 THEN 'yes' ELSE 'no' END FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st OR T1.wid = T2.w2nd WHERE T2.w1st = ( SELECT wid FROM words WHERE T1.word = 'fukunaga' ) AND T2.w2nd = ( SELECT wid FROM words WHERE word LIKE 'd%egees' )", "index": 2814, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'indicate', 'fukunaga', \"d'egees\", 'formed', \"d'egee\"]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['The Words', 'Second', 'First', 'Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word;  w1st = word = 'fukunaga' or w2nd = word = 'fukunaga'; w1st = word = 'd'egees'or w2nd = word = 'd'egees';\nIndicate if there is any pair formed by the words fukunaga and d'egees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Pages', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'repetitions', 'percentage', 'occurrence', 'repetition', 'calculate']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepetition refers to occurrences; 100 different words refers to words = 100; DIVIDE(SUM(occurrences where words = 100), COUNT(page where words = 100)) as percentage;\nCalculate the average of repetitions in the pages that have a total of 100 different words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(T2.occurrences) AS REAL) / COUNT(T1.page) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.words = 100", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(SUM(T2.occurrences) AS REAL) / COUNT(T1.page) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.words = 100", "index": 2815, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Pages', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'repetitions', 'percentage', 'occurrence', 'repetition', 'calculate']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepetition refers to occurrences; 100 different words refers to words = 100; DIVIDE(SUM(occurrences where words = 100), COUNT(page where words = 100)) as percentage;\nCalculate the average of repetitions in the pages that have a total of 100 different words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n title text, -- example: ['The Words', 'Second', 'First', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'occurrence', 'frequently', 'together', 'frequent']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow frequently refers to occurrences;  word 1 refers to wid = 1; word 25 refers to wid = 25; appear together means pair, which is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word;  w1st or w2nd = wid = 1; w1st or w2nd = wid = 25;\nHow frequently did the words 1 and 25 appear together?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT occurrences FROM biwords WHERE w1st = 1 AND w2nd = 25", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT occurrences FROM biwords WHERE w1st = 1 AND w2nd = 25", "index": 2816, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n title text, -- example: ['The Words', 'Second', 'First', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'occurrence', 'frequently', 'together', 'frequent']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow frequently refers to occurrences;  word 1 refers to wid = 1; word 25 refers to wid = 25; appear together means pair, which is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word;  w1st or w2nd = wid = 1; w1st or w2nd = wid = 25;\nHow frequently did the words 1 and 25 appear together?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'proportion', 'percentage', 'occurrence', 'repeated']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Catalan', 'Second', 'Times', 'First', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; in the Catalan language refers to lid; repeated less than 80 times refers to occurrences < 80; DIVIDE(COUNT(lid where occurrences < 80), COUNT(lid)) as percentage;\nWhat proportion of a pair of words in the Catalan language have been repeated less than 80 times?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(CASE WHEN occurrences < 80 THEN lid ELSE NULL END) AS REAL) * 100 / COUNT(lid) FROM biwords", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN occurrences < 80 THEN lid ELSE NULL END) AS REAL) * 100 / COUNT(lid) FROM biwords", "index": 2817, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'proportion', 'percentage', 'occurrence', 'repeated']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Catalan', 'Second', 'Times', 'First', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; in the Catalan language refers to lid; repeated less than 80 times refers to occurrences < 80; DIVIDE(COUNT(lid where occurrences < 80), COUNT(lid)) as percentage;\nWhat proportion of a pair of words in the Catalan language have been repeated less than 80 times?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Catalan', 'Nombre', 'Times', 'Word', 'TiME', 'TIME']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'language', 'catalan', 'itself', 'nombre']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Catalan means Catalan language and refers to lid = 1; How many times repeat refers to occurrences;\nHow many times does the Catalan word \"nombre\" repeat itself?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.occurrences FROM langs_words AS T1 INNER JOIN words AS T2 ON T1.wid = T2.wid WHERE T2.word = 'nombre'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.occurrences FROM langs_words AS T1 INNER JOIN words AS T2 ON T1.wid = T2.wid WHERE T2.word = 'nombre'", "index": 2818, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Catalan', 'Nombre', 'Times', 'Word', 'TiME', 'TIME']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'language', 'catalan', 'itself', 'nombre']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Catalan means Catalan language and refers to lid = 1; How many times repeat refers to occurrences;\nHow many times does the Catalan word \"nombre\" repeat itself?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'number', 'second', 'first', 'where', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; w1st = 1; w2nd = 8968;\nWhat is the second word in the pair of words number 1 and 8968?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT word FROM words WHERE wid = 8968", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT word FROM words WHERE wid = 8968", "index": 2819, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'number', 'second', 'first', 'where', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; w1st = 1; w2nd = 8968;\nWhat is the second word in the pair of words number 1 and 8968?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'votives', 'appear', 'votive', 'number']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Times', 'Word', 'TiME', 'TIME', 'Time', 'Many']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many times refers to occurrences; page number 44 refers to pid = 44;\nHow many times on page number 44 does the word \"votives\" appear?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'votives' AND T2.pid = 44", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T2.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'votives' AND T2.pid = 44", "index": 2820, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'votives', 'appear', 'votive', 'number']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Times', 'Word', 'TiME', 'TIME', 'Time', 'Many']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many times refers to occurrences; page number 44 refers to pid = 44;\nHow many times on page number 44 does the word \"votives\" appear?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'occurrence', 'second', 'number', 'appear']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Second', 'First', 'Times', 'Word', 'TiME', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many times appear refer to occurrences; page number 16 refers to pid = 16; Pair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; w1st = 1; w2nd = 109;\nHow many times on page number 16 does the second word in the pair of words 1 and 109 appear?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.occurrences) FROM pages_words AS T1 INNER JOIN biwords AS T2 ON T2.w2nd = T1.wid WHERE T2.w2nd = 109 AND T2.w1st = 1 AND T1.pid = 16", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT SUM(T1.occurrences) FROM pages_words AS T1 INNER JOIN biwords AS T2 ON T2.w2nd = T1.wid WHERE T2.w2nd = 109 AND T2.w1st = 1 AND T1.pid = 16", "index": 2821, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['relationship', 'occurrences', 'occurrence', 'second', 'number', 'appear']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Second', 'First', 'Times', 'Word', 'TiME', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many times appear refer to occurrences; page number 16 refers to pid = 16; Pair is a relationship of two words: w1st and w2nd, where w1st is word id of the first word and w2nd is a word id of the second word; w1st = 1; w2nd = 109;\nHow many times on page number 16 does the second word in the pair of words 1 and 109 appear?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['The Words', 'Catalan', 'Times', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'percentage', 'occurrence', 'language', 'repeated', 'catalan']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepeated under 180 times refers to occurrences < 180; Catalan language refers to lang = 'ca'; DIVIDE(COUNT(words WHERE occurrences < 180 and lang = 'ca'), COUNT(words WHERE lang = 'ca')) as percentage;\nWhat is the percentage of the words that have been repeated under 180 times in the Catalan language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(CASE WHEN T2.occurrences < 180 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.lid) FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T1.lang = 'ca'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.occurrences < 180 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.lid) FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T1.lang = 'ca'", "index": 2822, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['The Words', 'Catalan', 'Times', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'percentage', 'occurrence', 'language', 'repeated', 'catalan']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepeated under 180 times refers to occurrences < 180; Catalan language refers to lang = 'ca'; DIVIDE(COUNT(words WHERE occurrences < 180 and lang = 'ca'), COUNT(words WHERE lang = 'ca')) as percentage;\nWhat is the percentage of the words that have been repeated under 180 times in the Catalan language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Desena', 'Times', 'Word', 'TiME', 'TIME', 'Time']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'desena', 'occurs', 'refer', 'occur']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many times occurs refers to occurrences;\nHow many times the word \"desena\" occurs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT occurrences FROM words WHERE word = 'desena'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT occurrences FROM words WHERE word = 'desena'", "index": 2823, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Desena', 'Times', 'Word', 'TiME', 'TIME', 'Time']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'desena', 'occurs', 'refer', 'occur']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many times occurs refers to occurrences;\nHow many times the word \"desena\" occurs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'appearance', 'greater', 'appear', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappearance times greater than 10 refers to occurrences > 10;\nHow many words has the appearance times greater than 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(w1st) AS countwords FROM biwords WHERE occurrences > 10", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(w1st) AS countwords FROM biwords WHERE occurrences > 10", "index": 2824, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'appearance', 'greater', 'appear', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappearance times greater than 10 refers to occurrences > 10;\nHow many words has the appearance times greater than 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Title', 'State', 'Ha', 'ID', 'Àbac']\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrevision page id of 28040864 refers to revision = 28040864;\nState the Wikipedia page title that has revision page id of 28040864.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM pages WHERE revision = 28040864", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT title FROM pages WHERE revision = 28040864", "index": 2825, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Title', 'State', 'Ha', 'ID', 'Àbac']\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrevision page id of 28040864 refers to revision = 28040864;\nState the Wikipedia page title that has revision page id of 28040864.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['language', 'locale', 'titled', 'local', 'refer', 'title']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Anys 90', 'Local', 'Title', 'Anys', 'Any', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage titled \"Anys 90\" refers to title = 'Anys 90';\nWhat is the locale of the language of the page titled \"Anys 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.locale FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T2.title = 'Anys 90'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.locale FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T2.title = 'Anys 90'", "index": 2826, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['language', 'locale', 'titled', 'local', 'refer', 'title']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Anys 90', 'Local', 'Title', 'Anys', 'Any', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npage titled \"Anys 90\" refers to title = 'Anys 90';\nWhat is the locale of the language of the page titled \"Anys 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 pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['language', 'locale', 'titled', 'local', 'refer', 'abril']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Local', 'Abril', 'Title', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe page titled \"Abril\" refers to title = 'Abril';\nWhat is the locale of the language of the page titled \"Abril\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.locale FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T2.title = 'Abril'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.locale FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T2.title = 'Abril'", "index": 2827, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['language', 'locale', 'titled', 'local', 'refer', 'abril']\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Local', 'Abril', 'Title', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe page titled \"Abril\" refers to title = 'Abril';\nWhat is the locale of the language of the page titled \"Abril\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['different', 'differ', 'number', 'equal', 'words', 'word']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThis is not;\nHow many word that has number of different words equal to 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.wid) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.words = 3", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(T2.wid) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.words = 3", "index": 2828, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['different', 'differ', 'number', 'equal', 'words', 'word']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThis is not;\nHow many word that has number of different words equal to 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'language', 'appeared', 'appear', 'state']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappeared 8 times refers to occurrences = 8;\nHow many word appeared 8 times? State the language id of the page.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.wid), T1.lid FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.occurrences = 8", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(T2.wid), T1.lid FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.occurrences = 8", "index": 2829, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'language', 'appeared', 'appear', 'state']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nappeared 8 times refers to occurrences = 8;\nHow many word appeared 8 times? State the language id of the page.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'percentage', 'occurrence', 'appearance', 'calculate', 'revision']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrevision page id smaller than 106680 refers to revision < 106680; word appearance refers to occurrences; DIVIDE(SUM(occurrences where revision < 106680), COUNT(occurrences)) as percentage;\nCalculate the average percentage of word appearance in the page that have revision page id smaller than 106680.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T1.words) AS REAL) * 100 / SUM(T2.occurrences) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.revision < 106680", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CAST(SUM(T1.words) AS REAL) * 100 / SUM(T2.occurrences) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.revision < 106680", "index": 2830, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'percentage', 'occurrence', 'appearance', 'calculate', 'revision']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Word', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrevision page id smaller than 106680 refers to revision < 106680; word appearance refers to occurrences; DIVIDE(SUM(occurrences where revision < 106680), COUNT(occurrences)) as percentage;\nCalculate the average percentage of word appearance in the page that have revision page id smaller than 106680.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'repeated', 'repeat', 'words', 'pages']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['The Words', 'Pages', 'Times', 'Word', 'TiME', 'TIME']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepeated more than 3000 times refers to occurrences > 3000;\nList out the total pages of the words that has repeated times more than 3000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.pages FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T2.occurrences > 3000 GROUP BY T1.pages", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.pages FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T2.occurrences > 3000 GROUP BY T1.pages", "index": 2831, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'repeated', 'repeat', 'words', 'pages']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['The Words', 'Pages', 'Times', 'Word', 'TiME', 'TIME']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepeated more than 3000 times refers to occurrences > 3000;\nList out the total pages of the words that has repeated times more than 3000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['state', 'refer', 'pair', 'name', 'have', 'word']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword that have id of 20 refers to wid = 20; word that have id of 50 refers to wid = 50;\nState the name of the pair of word that have id of 20 and 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 T1.word, T3.word FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T2.w1st = 20 AND T2.w2nd = 50", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.word, T3.word FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T2.w1st = 20 AND T2.w2nd = 50", "index": 2832, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['state', 'refer', 'pair', 'name', 'have', 'word']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword that have id of 20 refers to wid = 20; word that have id of 50 refers to wid = 50;\nState the name of the pair of word that have id of 20 and 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 langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Please', 'Pages', 'Title', 'Word']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'language', 'catalan', 'titles', 'please', 'pages']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCatalan language refers to lid = 1; more than 4000 words refers to words > 4000;\nPlease list the titles of the Wikipedia pages on the Catalan language with more than 4000 words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM pages WHERE lid = 1 AND words > 4000", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT title FROM pages WHERE lid = 1 AND words > 4000", "index": 2833, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Please', 'Pages', 'Title', 'Word']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'language', 'catalan', 'titles', 'please', 'pages']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCatalan language refers to lid = 1; more than 4000 words refers to words > 4000;\nPlease list the titles of the Wikipedia pages on the Catalan language with more than 4000 words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'catalan', 'please', 'words', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noccurrence of over 200000 refers to occurrences > 200000;\nPlease list the Catalan words with an occurrence of over 200000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT word FROM words WHERE occurrences > 200000", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT word FROM words WHERE occurrences > 200000", "index": 2834, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'catalan', 'please', 'words', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noccurrence of over 200000 refers to occurrences > 200000;\nPlease list the Catalan words with an occurrence of over 200000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'titled', 'title', 'refer', 'occur']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Title', 'Times', 'GREC', 'Grec', 'Word', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow many times occur refers to occurrences; page titled \"Àbac\" refers to title = 'Àbac' ;\nHow many times did the word \"grec\" occur on the page titled \"Àbac\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T3.title = 'Àbac' AND T1.word = 'grec'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T2.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T3.title = 'Àbac' AND T1.word = 'grec'", "index": 2835, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'titled', 'title', 'refer', 'occur']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Title', 'Times', 'GREC', 'Grec', 'Word', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow many times occur refers to occurrences; page titled \"Àbac\" refers to title = 'Àbac' ;\nHow many times did the word \"grec\" occur on the page titled \"Àbac\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Xinès', 'GREC', 'Grec', 'Word', 'Àbac', 'Max']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'higher', 'which', 'xinès', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigher occurrence is MAX(occurrences); àbac refers to word = 'àbac'; xinès refers to word = 'xinès'; grec refers to word = 'grec'\nWhich biwords pair has a higher occurrence, \"àbac-xinès\" or \"àbac-grec\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) > ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'grec' ) ) THEN 'àbac-xinès' ELSE 'àbac-grec' END AS CALUS FROM words LIMIT 1", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT CASE WHEN ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) > ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'grec' ) ) THEN 'àbac-xinès' ELSE 'àbac-grec' END AS CALUS FROM words LIMIT 1", "index": 2836, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Xinès', 'GREC', 'Grec', 'Word', 'Àbac', 'Max']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'higher', 'which', 'xinès', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigher occurrence is MAX(occurrences); àbac refers to word = 'àbac'; xinès refers to word = 'xinès'; grec refers to word = 'grec'\nWhich biwords pair has a higher occurrence, \"àbac-xinès\" or \"àbac-grec\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['please', 'pairs', 'first', 'words', 'refer', 'pair']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nàbac refers to word = 'àbac'; first word refers to w1st\nPlease list all the biwords pairs with \"àbac\" as its first word.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.word AS W1, T3.word AS W2 FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'àbac'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.word AS W1, T3.word AS W2 FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'àbac'", "index": 2837, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['please', 'pairs', 'first', 'words', 'refer', 'pair']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nàbac refers to word = 'àbac'; first word refers to w1st\nPlease list all the biwords pairs with \"àbac\" as its first word.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'pairs', 'total', 'first', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noccurrence refers to occurrences; àbac refers to word = 'àbac'; first word refers to w1st\nWhat is the total occurrence of the biwords pairs with \"àbac\" as its first word?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.w1st) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'àbac'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(T2.w1st) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'àbac'", "index": 2838, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'occurrence', 'pairs', 'total', 'first', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noccurrence refers to occurrences; àbac refers to word = 'àbac'; first word refers to w1st\nWhat is the total occurrence of the biwords pairs with \"àbac\" as its first word?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Pages', 'Many', 'Lang', 'DOE']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCatalan language refers to lang = 'ca'\nHow many pages does the Catalan language have in Wikipedia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT pages FROM langs WHERE lang = 'ca'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT pages FROM langs WHERE lang = 'ca'", "index": 2839, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Pages', 'Many', 'Lang', 'DOE']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCatalan language refers to lang = 'ca'\nHow many pages does the Catalan language have in Wikipedia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'repetitions', 'occurrence', 'repetition', 'language', 'catalan']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n title text, -- example: ['Catalan', 'Most', 'Word', 'Max', 'Ha', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword with the most repetitions refers to MAX(occurrences); ID of the word refers to wid\nWhich word has the most repetitions in the Catalan language? Give the ID of the word.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT wid FROM langs_words WHERE occurrences = ( SELECT MAX(occurrences) FROM langs_words )", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT wid FROM langs_words WHERE occurrences = ( SELECT MAX(occurrences) FROM langs_words )", "index": 2840, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'repetitions', 'occurrence', 'repetition', 'language', 'catalan']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n title text, -- example: ['Catalan', 'Most', 'Word', 'Max', 'Ha', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword with the most repetitions refers to MAX(occurrences); ID of the word refers to wid\nWhich word has the most repetitions in the Catalan language? Give the ID of the word.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['periodograma', 'state', 'refer', 'word', 'wid', 'id']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['State', 'Word', 'ID', 'The Words', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword ID refers to wid; periodograma refers to word = 'periodograma'\nState the word ID for \"periodograma\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT wid FROM words WHERE word = 'periodograma'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT wid FROM words WHERE word = 'periodograma'", "index": 2841, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['periodograma', 'state', 'refer', 'word', 'wid', 'id']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['State', 'Word', 'ID', 'The Words', 'Àbac', 'Abadia']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nword ID refers to wid; periodograma refers to word = 'periodograma'\nState the word ID for \"periodograma\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appears', 'appear', 'where', 'words', 'refer', 'pair']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nriu refers to word = 'riu'; SUM(w1st where wid is word = 'riu' AND w2nd where wid is word = 'riu')\nHow many times does the word \"riu\" appears in the biwords pair?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.wid) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'riu'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(T1.wid) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'riu'", "index": 2842, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appears', 'appear', 'where', 'words', 'refer', 'pair']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nriu refers to word = 'riu'; SUM(w1st where wid is word = 'riu' AND w2nd where wid is word = 'riu')\nHow many times does the word \"riu\" appears in the biwords pair?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Pages', 'Title', 'Astre', 'Many', 'Word']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appearances', 'appearance', 'wikipedia', 'appear', 'pages', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAstre refers to title = 'Astre'; word ID No. 2823 refers to wid = 2823; appearances refers to pages_words_sampling.occurrences\nHow many appearances does the word ID No. 2823 have in the Wikipedia page \"Astre\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T2.occurrences) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Astre' AND T2.wid = 2823", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT SUM(T2.occurrences) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Astre' AND T2.wid = 2823", "index": 2843, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Pages', 'Title', 'Astre', 'Many', 'Word']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['appearances', 'appearance', 'wikipedia', 'appear', 'pages', 'words']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAstre refers to title = 'Astre'; word ID No. 2823 refers to wid = 2823; appearances refers to pages_words_sampling.occurrences\nHow many appearances does the word ID No. 2823 have in the Wikipedia page \"Astre\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'heròdot', 'appear', 'refer', 'page', 'does']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Heròdot', 'Times', 'Many', 'TiME', 'TIME']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheròdot refers to word = 'heròdot'; times appear refers to SUM(pid)\nHow many times does the word \"heròdot\" appear in the Wikipedia page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.occurrences) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'heròdot'", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(T2.occurrences) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'heròdot'", "index": 2844, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'heròdot', 'appear', 'refer', 'page', 'does']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Heròdot', 'Times', 'Many', 'TiME', 'TIME']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheròdot refers to word = 'heròdot'; times appear refers to SUM(pid)\nHow many times does the word \"heròdot\" appear in the Wikipedia page?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'appearances', 'occurrence', 'appearance', 'wikipedia', 'revision']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most appearances refers to MAX(occurrences); revision ID No. 28278070 refers to revision = 28278070; word ID refers to wid\nWhich word has the most appearances in the Wikipedia page revision ID No. 28278070? Give the word ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT pid FROM pages_words WHERE pid = ( SELECT pid FROM pages WHERE revision = 28278070 ) ORDER BY occurrences DESC LIMIT 1", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT pid FROM pages_words WHERE pid = ( SELECT pid FROM pages WHERE revision = 28278070 ) ORDER BY occurrences DESC LIMIT 1", "index": 2845, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'appearances', 'occurrence', 'appearance', 'wikipedia', 'revision']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most appearances refers to MAX(occurrences); revision ID No. 28278070 refers to revision = 28278070; word ID refers to wid\nWhich word has the most appearances in the Wikipedia page revision ID No. 28278070? Give the word ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['language', 'gregorio', 'appear', 'words', 'where', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nque gregorio refers to w1st = wid where word = 'que' AND w2nd = wid where word = 'gregorio'; appear refers to biwords.occurrences\nHow many times does the biwords \"que gregorio\" appear in the language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'que' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'gregorio' )", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'que' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'gregorio' )", "index": 2846, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['language', 'gregorio', 'appear', 'words', 'where', 'refer']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nque gregorio refers to w1st = wid where word = 'que' AND w2nd = wid where word = 'gregorio'; appear refers to biwords.occurrences\nHow many times does the biwords \"que gregorio\" appear in the language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Catalan', 'Times', 'Show', 'TiME', 'TIME', 'Time']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['repetition', 'language', 'catalan', 'repetit', 'exemple', 'menas']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nexemple refers to word = 'exemple'; repetition refers to langs_words.occurrences; lid = 1 menas it's Catalan language\nHow many times of repetition does the word \"exemple\" show in the Catalan language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.occurrences FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'exemple' AND T2.lid = 1", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T2.occurrences FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'exemple' AND T2.lid = 1", "index": 2847, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Catalan', 'Times', 'Show', 'TiME', 'TIME', 'Time']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['repetition', 'language', 'catalan', 'repetit', 'exemple', 'menas']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nexemple refers to word = 'exemple'; repetition refers to langs_words.occurrences; lid = 1 menas it's Catalan language\nHow many times of repetition does the word \"exemple\" show in the Catalan language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'repetitions', 'occurrence', 'repetition', 'language', 'repetit']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlid = 1 menas it's Catalan language; 274499 repetitions refers to occurrences = 274499\nWhich word that has 274499 repetitions in the Catalan language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.word FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = 274499 AND T2.lid = 1", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT T1.word FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = 274499 AND T2.lid = 1", "index": 2848, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n revision integer, -- example: [28236978, 24086480]\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['occurrences', 'repetitions', 'occurrence', 'repetition', 'language', 'repetit']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n locale text, -- example: ['ca_ES']\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlid = 1 menas it's Catalan language; 274499 repetitions refers to occurrences = 274499\nWhich word that has 274499 repetitions in the Catalan language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'different', 'language', 'catalan', 'please', 'titles']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Please', 'Pages', 'Title', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlid = 1 means it's Catalan language; 10 different words refers to words = 10; titles refers to title\nPlease list the titles of all the Wikipedia pages on the Catalan language with 10 different words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM pages WHERE lid = 1 AND words = 10 LIMIT 10", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT title FROM pages WHERE lid = 1 AND words = 10 LIMIT 10", "index": 2849, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'different', 'language', 'catalan', 'please', 'titles']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Please', 'Pages', 'Title', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlid = 1 means it's Catalan language; 10 different words refers to words = 10; titles refers to title\nPlease list the titles of all the Wikipedia pages on the Catalan language with 10 different words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'different', 'language', 'catalan', 'titles', 'please']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Please', 'Pages', 'Title', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlid = 1 means it's Catalan language; with most different words refers to MAX(words)\nPlease list the titles of the top 3 Wikipedia pages with the most different words on the Catalan language.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title FROM pages WHERE lid = 1 ORDER BY words DESC LIMIT 3", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT title FROM pages WHERE lid = 1 ORDER BY words DESC LIMIT 3", "index": 2850, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'different', 'language', 'catalan', 'titles', 'please']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n revision integer, -- example: [28236978, 24086480]\n title text, -- example: ['Wikipedia', 'Catalan', 'Please', 'Pages', 'Title', 'Àbac']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlid = 1 means it's Catalan language; with most different words refers to MAX(words)\nPlease list the titles of the top 3 Wikipedia pages with the most different words on the Catalan language.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'appearing', 'catalan', 'appear', 'nombre', 'pages']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Nombre', 'Pages', 'Times', 'Many']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnombre refers to word = 'nombre'; appear for more than 5 times refers to  pages_words.occurrences > 5\nHow many Wikipedia pages on Catalan are there with the word \"nombre\" appearing for more than 5 times?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.pid) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'nombre' AND T2.occurrences > 5", "style": "rule" }
{ "db_id": "language_corpus.sqlite", "gt_sql": "SELECT COUNT(T2.pid) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'nombre' AND T2.occurrences > 5", "index": 2851, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pages_words (\n pid integer, -- page id, example: [1, 2]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [30, 8]\n PRIMARY KEY (pid, wid),\n CONSTRAINT fk_pages_words_pid FOREIGN KEY (pid) REFERENCES pages (pid),\n CONSTRAINT fk_pages_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\n\nCREATE TABLE biwords (\n lid integer, -- language id, example: [1]\n w1st integer, -- word id of the first word, example: [1, 2]\n w2nd integer, -- word id of the second word, example: [2, 4]\n occurrences integer, -- example: [4, 3]\n PRIMARY KEY (lid, w1st, w2nd),\n CONSTRAINT fk_biwords_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_biwords_w1st FOREIGN KEY (w1st) REFERENCES words (wid),\n CONSTRAINT fk_biwords_w2nd FOREIGN KEY (w2nd) REFERENCES words (wid)\n);\n\nCREATE TABLE langs (\n lid integer, -- language id, example: [1]\n lang text, -- language, example: ['ca']\n pages integer, -- example: [1129144]\n words integer, -- example: [2764996]\n PRIMARY KEY (lid)\n);\n\nCREATE TABLE words (\n wid integer, -- word id, example: [2148990, 2506463]\n word text, -- example: ['wikipedia', 'appearing', 'catalan', 'appear', 'nombre', 'pages']\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (wid)\n);\n\nCREATE TABLE pages (\n pid integer, -- page id, example: [1, 2]\n lid integer, -- language id, example: [1]\n page integer, -- example: [1, 2]\n title text, -- example: ['Wikipedia', 'Catalan', 'Nombre', 'Pages', 'Times', 'Many']\n words integer, -- example: [1081, 68]\n PRIMARY KEY (pid),\n CONSTRAINT fk_pages_lid FOREIGN KEY (lid) REFERENCES langs (lid)\n);\n\nCREATE TABLE langs_words (\n lid integer, -- language id, example: [1]\n wid integer, -- word id, example: [1, 2]\n occurrences integer, -- example: [242, 16841]\n PRIMARY KEY (lid, wid),\n CONSTRAINT fk_langs_words_lid FOREIGN KEY (lid) REFERENCES langs (lid),\n CONSTRAINT fk_langs_words_wid FOREIGN KEY (wid) REFERENCES words (wid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnombre refers to word = 'nombre'; appear for more than 5 times refers to  pages_words.occurrences > 5\nHow many Wikipedia pages on Catalan are there with the word \"nombre\" appearing for more than 5 times?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\non 2018/8/1 refers to FL_DATE = '2018/8/1';\nHow many flights were there on 2018/8/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 COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1'", "index": 2852, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\non 2018/8/1 refers to FL_DATE = '2018/8/1';\nHow many flights were there on 2018/8/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 `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n CANCELLED integer, -- example: [0, 1]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndestination cities refers to DEST; cancelled refers to CANCELLED = 1; on 2018/8/1 refers to FL_DATE = '2018/8/1';\nPlease list the destination cities of all the flights that were cancelled on 2018/8/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 DEST FROM Airlines WHERE FL_DATE = '2018/8/1' AND CANCELLED = 1 GROUP BY DEST", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT DEST FROM Airlines WHERE FL_DATE = '2018/8/1' AND CANCELLED = 1 GROUP BY DEST", "index": 2853, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n CANCELLED integer, -- example: [0, 1]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndestination cities refers to DEST; cancelled refers to CANCELLED = 1; on 2018/8/1 refers to FL_DATE = '2018/8/1';\nPlease list the destination cities of all the flights that were cancelled on 2018/8/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 Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n WEATHER_DELAY integer, -- example: [0, 2]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'NEW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\ndeparting from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International'; arrived earlier than scheduled refers to ARR_DELAY < 0;\nAmong the flights departing from John F. Kennedy International, how many of them arrived earlier than scheduled?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T2.ARR_DELAY < 0 THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'New York, NY: John F. Kennedy International'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.ARR_DELAY < 0 THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'New York, NY: John F. Kennedy International'", "index": 2854, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n WEATHER_DELAY integer, -- example: [0, 2]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'NEW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\ndeparting from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International'; arrived earlier than scheduled refers to ARR_DELAY < 0;\nAmong the flights departing from John F. Kennedy International, how many of them arrived earlier than scheduled?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\non 2018/8/1 refers to FL_DATE = '2018/8/1'; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';\nHow many flights on 2018/8/1 were operated by American Airlines Inc.?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1' AND T3.Description = 'American Airlines Inc.: AA'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1' AND T3.Description = 'American Airlines Inc.: AA'", "index": 2855, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\non 2018/8/1 refers to FL_DATE = '2018/8/1'; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';\nHow many flights on 2018/8/1 were operated by American Airlines Inc.?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['NEW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nflight numbers refers to OP_CARRIER_FL_NUM; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; depart from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International';\nPlease list the flight numbers of all the flights operated by American Airlines Inc. that were scheduled to depart from John F. Kennedy International.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.OP_CARRIER_FL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA' AND T1.Description = 'New York, NY: John F. Kennedy International' AND T2.FL_DATE = '2018/8/1'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.OP_CARRIER_FL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA' AND T1.Description = 'New York, NY: John F. Kennedy International' AND T2.FL_DATE = '2018/8/1'", "index": 2856, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['NEW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nflight numbers refers to OP_CARRIER_FL_NUM; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; depart from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International';\nPlease list the flight numbers of all the flights operated by American Airlines Inc. that were scheduled to depart from John F. Kennedy International.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Endeavor Air Inc.: 9E', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['INC', 'SUM', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUM(Description = 'American Airlines Inc.: AA') > SUM(Description = 'Endeavor Air Inc.: 9E') means American Airlines Inc. operated more flights than  Endeavor Air Inc; SUM(Description = 'American Airlines Inc.: AA') < SUM(Description = 'Endeavor Air Inc.: 9E') means Endeavor Air Inc. operated more flights than American Airlines Inc.; on 2018/8/1 refers to FL_DATE = '2018/8/1';\nWhich airline operated more flights on 2018/8/1, American Airlines Inc. or Endeavor Air Inc.?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CASE WHEN COUNT(CASE WHEN T3.Description = 'American Airlines Inc.: AA' THEN 1 ELSE NULL END) > COUNT(CASE WHEN T3.Description = 'Endeavor Air Inc.: 9E' THEN 1 ELSE NULL END) THEN 'American Airlines Inc.: AA' ELSE 'Endeavor Air Inc.: 9E' END AS RESULT FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT CASE WHEN COUNT(CASE WHEN T3.Description = 'American Airlines Inc.: AA' THEN 1 ELSE NULL END) > COUNT(CASE WHEN T3.Description = 'Endeavor Air Inc.: 9E' THEN 1 ELSE NULL END) THEN 'American Airlines Inc.: AA' ELSE 'Endeavor Air Inc.: 9E' END AS RESULT FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1'", "index": 2857, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Endeavor Air Inc.: 9E', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['INC', 'SUM', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/17', '2018/8/16', '2018/8/15', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUM(Description = 'American Airlines Inc.: AA') > SUM(Description = 'Endeavor Air Inc.: 9E') means American Airlines Inc. operated more flights than  Endeavor Air Inc; SUM(Description = 'American Airlines Inc.: AA') < SUM(Description = 'Endeavor Air Inc.: 9E') means Endeavor Air Inc. operated more flights than American Airlines Inc.; on 2018/8/1 refers to FL_DATE = '2018/8/1';\nWhich airline operated more flights on 2018/8/1, American Airlines Inc. or Endeavor Air Inc.?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['INC', 'SUM', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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 departure delay time = DIVIDE(SUM(DEP_DELAY), COUNT(Code)); American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';\nWhat is the average departure delay time of flights operated by American Airlines Inc.?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T1.DEP_DELAY) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T1.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT AVG(T1.DEP_DELAY) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T1.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA'", "index": 2858, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['INC', 'SUM', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['American Airlines Inc.: AA', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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 departure delay time = DIVIDE(SUM(DEP_DELAY), COUNT(Code)); American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';\nWhat is the average departure delay time of flights operated by American Airlines Inc.?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nWhat is the number of air carriers in the database?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Code) FROM `Air Carriers`", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(Code) FROM `Air Carriers`", "index": 2859, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nWhat is the number of air carriers in the database?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/7', '2018/8/2', '2018/8/1', '2018/8/8']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanded on refers to DEST; Oakland Airport refers to Description which contains 'Oakland'; on 2018/8/7 refers to FL_DATE = '2018/8/7';\nProvide the number of airplanes that landed on Oakland Airport on 2018/8/7.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.Description LIKE '%Oakland%' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/7'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.Description LIKE '%Oakland%' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/7'", "index": 2860, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/7', '2018/8/2', '2018/8/1', '2018/8/8']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanded on refers to DEST; Oakland Airport refers to Description which contains 'Oakland'; on 2018/8/7 refers to FL_DATE = '2018/8/7';\nProvide the number of airplanes that landed on Oakland Airport on 2018/8/7.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/2', '2018/8/1', '2018/8/8']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Alaska Airlines Inc.: AS', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nAlaska Airlines refers to Description = 'Alaska Airlines Inc.: AS'; delayed refers to DEP_DELAY > 0; on 2018/8/2 refers to FL_DATE = '2018/8/2';\nHow many flights of Alaska Airlines were delayed on 2018/8/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 COUNT(*) FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/2' AND T2.Description = 'Alaska Airlines Inc.: AS' AND T1.DEP_DELAY > 0", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/2' AND T2.Description = 'Alaska Airlines Inc.: AS' AND T1.DEP_DELAY > 0", "index": 2861, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/2', '2018/8/1', '2018/8/8']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Alaska Airlines Inc.: AS', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nAlaska Airlines refers to Description = 'Alaska Airlines Inc.: AS'; delayed refers to DEP_DELAY > 0; on 2018/8/2 refers to FL_DATE = '2018/8/2';\nHow many flights of Alaska Airlines were delayed on 2018/8/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 Airports (\n Code text, -- example: ['HOW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/31', '2018/8/2', '2018/8/1', '2018/8/8']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Endeavor Air Inc.: 9E', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nEndeavor Air Inc. refers to Description = 'Endeavor Air Inc.: 9E'; faster than scheduled refers to ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME; on 2018/8/31 refers to FL_DATE = '2018/8/31';\nHow many flights of Endeavor Air Inc. were faster than scheduled on 2018/8/31?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS count FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/31' AND T2.Description = 'Endeavor Air Inc.: 9E'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS count FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/31' AND T2.Description = 'Endeavor Air Inc.: 9E'", "index": 2862, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/31', '2018/8/2', '2018/8/1', '2018/8/8']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Endeavor Air Inc.: 9E', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nEndeavor Air Inc. refers to Description = 'Endeavor Air Inc.: 9E'; faster than scheduled refers to ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME; on 2018/8/31 refers to FL_DATE = '2018/8/31';\nHow many flights of Endeavor Air Inc. were faster than scheduled on 2018/8/31?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N702SK', 'N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntail number refers to TAIL_NUM; TAIL_NUM = 'N702SK';\nFor the flight with the tail number 'N702SK', which air carrier does it belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.TAIL_NUM = 'N702SK' GROUP BY T2.Description", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.TAIL_NUM = 'N702SK' GROUP BY T2.Description", "index": 2863, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N702SK', 'N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntail number refers to TAIL_NUM; TAIL_NUM = 'N702SK';\nFor the flight with the tail number 'N702SK', which air carrier does it belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/15', '2018/8/1', '2018/8/17', '2018/8/16', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Lake Charles, LA: Lake Charles Regional', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nlanded at refers to DEST; Lake Charles Regional Airport refers to Description = 'Lake Charles, LA: Lake Charles Regional'; on 2018/8/15 refers to FL_DATE = '2018/8/15';\nTell the number of flights that landed at Lake Charles Regional Airport on 2018/8/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 COUNT(T1.Code) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/15' AND T1.Description = 'Lake Charles, LA: Lake Charles Regional'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(T1.Code) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/15' AND T1.Description = 'Lake Charles, LA: Lake Charles Regional'", "index": 2864, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/15', '2018/8/1', '2018/8/17', '2018/8/16', '2018/8/14', '2018/8/13']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Lake Charles, LA: Lake Charles Regional', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nlanded at refers to DEST; Lake Charles Regional Airport refers to Description = 'Lake Charles, LA: Lake Charles Regional'; on 2018/8/15 refers to FL_DATE = '2018/8/15';\nTell the number of flights that landed at Lake Charles Regional Airport on 2018/8/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 Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['C', 'A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['DUE', 'LOS', 'SUM', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\npercentage = MULTIPLY(DIVIDE(SUM(CANCELLATION_CODE = 'C'), COUNT(Code)), 100); flights from refers to ORIGIN; Los Angeles International airport refers to Description = 'Los Angeles, CA: Los Angeles International'; cancelled refers to Cancelled = 1; cancelled due to a type C cancellation code refers to CANCELLATION_CODE = 'C';\nWhat is the percentage of flights from Los Angeles International airport that were cancelled due to a type C cancellation 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 CAST(SUM(CASE WHEN T2.CANCELLATION_CODE = 'C' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/15' AND T2.CANCELLATION_CODE IS NOT NULL AND T1.Description = 'Los Angeles, CA: Los Angeles International'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.CANCELLATION_CODE = 'C' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/15' AND T2.CANCELLATION_CODE IS NOT NULL AND T1.Description = 'Los Angeles, CA: Los Angeles International'", "index": 2865, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['C', 'A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['DUE', 'LOS', 'SUM', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\npercentage = MULTIPLY(DIVIDE(SUM(CANCELLATION_CODE = 'C'), COUNT(Code)), 100); flights from refers to ORIGIN; Los Angeles International airport refers to Description = 'Los Angeles, CA: Los Angeles International'; cancelled refers to Cancelled = 1; cancelled due to a type C cancellation code refers to CANCELLATION_CODE = 'C';\nWhat is the percentage of flights from Los Angeles International airport that were cancelled due to a type C cancellation 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 `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\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 description of the airline code 19049?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Description FROM `Air Carriers` WHERE Code = 19049", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Description FROM `Air Carriers` WHERE Code = 19049", "index": 2866, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\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 description of the airline code 19049?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nairport found in Ankara, Turkey refers to Description like '%Ankara, Turkey%';\nWhat are the codes of the airport found in Ankara, Turkey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Code FROM Airports WHERE Description LIKE '%Ankara, Turkey%'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Code FROM Airports WHERE Description LIKE '%Ankara, Turkey%'", "index": 2867, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nairport found in Ankara, Turkey refers to Description like '%Ankara, Turkey%';\nWhat are the codes of the airport found in Ankara, Turkey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'MAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n WEATHER_DELAY integer, -- example: [0, 2]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest minute delay caused by a weather problem refers to MAX(WEATHER_DELAY); airport id refers to ORIGIN_AIRPORT_ID; ORIGIN_AIRPORT_ID = 12264;\nHow long was the longest minute delay caused by a weather problem in airport id 12264?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT WEATHER_DELAY FROM Airlines WHERE ORIGIN_AIRPORT_ID = 12264 ORDER BY WEATHER_DELAY DESC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT WEATHER_DELAY FROM Airlines WHERE ORIGIN_AIRPORT_ID = 12264 ORDER BY WEATHER_DELAY DESC LIMIT 1", "index": 2868, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'MAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n WEATHER_DELAY integer, -- example: [0, 2]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest minute delay caused by a weather problem refers to MAX(WEATHER_DELAY); airport id refers to ORIGIN_AIRPORT_ID; ORIGIN_AIRPORT_ID = 12264;\nHow long was the longest minute delay caused by a weather problem in airport id 12264?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n WEATHER_DELAY integer, -- example: [0, 2]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['BAY', '01A', '03A']\n Description text, -- example: ['Anita Bay, AK: Anita Bay Airport', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nIATA code refers to Code; Anita Bay Airport in Anita Bay, Alaska refers to Description = 'Anita Bay, AK: Anita Bay Airport';\nWhat is the IATA code of the Anita Bay Airport in Anita Bay, Alaska?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Code FROM Airports WHERE Description = 'Anita Bay, AK: Anita Bay Airport'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Code FROM Airports WHERE Description = 'Anita Bay, AK: Anita Bay Airport'", "index": 2869, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n WEATHER_DELAY integer, -- example: [0, 2]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['BAY', '01A', '03A']\n Description text, -- example: ['Anita Bay, AK: Anita Bay Airport', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nIATA code refers to Code; Anita Bay Airport in Anita Bay, Alaska refers to Description = 'Anita Bay, AK: Anita Bay Airport';\nWhat is the IATA code of the Anita Bay Airport in Anita Bay, Alaska?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndepart to refers to DEST; Hartsfield-Jackson Atlanta International refers to Description = 'Atlanta, GA: Hartsfield-Jackson Atlanta International'; depart from refers to ORIGIN; Chicago O'Hare International refes to Description = 'Chicago, IL: Chicago O'Hare International';\nHow many flights depart to Hartsfield-Jackson Atlanta International from Chicago O'Hare International?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(FL_DATE) FROM Airlines WHERE ORIGIN = ( SELECT T2.ORIGIN FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'Chicago, IL: Chicago O''Hare International' ) AND DEST = ( SELECT T4.DEST FROM Airports AS T3 INNER JOIN Airlines AS T4 ON T3.Code = T4.DEST WHERE T3.Description = 'Atlanta, GA: Hartsfield-Jackson Atlanta International' )", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(FL_DATE) FROM Airlines WHERE ORIGIN = ( SELECT T2.ORIGIN FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'Chicago, IL: Chicago O''Hare International' ) AND DEST = ( SELECT T4.DEST FROM Airports AS T3 INNER JOIN Airlines AS T4 ON T3.Code = T4.DEST WHERE T3.Description = 'Atlanta, GA: Hartsfield-Jackson Atlanta International' )", "index": 2870, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndepart to refers to DEST; Hartsfield-Jackson Atlanta International refers to Description = 'Atlanta, GA: Hartsfield-Jackson Atlanta International'; depart from refers to ORIGIN; Chicago O'Hare International refes to Description = 'Chicago, IL: Chicago O'Hare International';\nHow many flights depart to Hartsfield-Jackson Atlanta International from Chicago O'Hare International?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['HAD', 'DUE', 'MAX', 'DAY', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN text, -- example: ['DAY', 'JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST text, -- destination, example: ['DAY', 'PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOn August 2018 refers to FL_DATE like '2018/8%'; day with the highest number of cancelled flights refers to MAX(COUNT(FL_DATE WHERE CANCELLED = 1)); cancelled due to the most serious reasons refers to CANCELLATION_CODE = 'A'; in Dallas/Fort Worth International refers to Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International';\nOn August 2018, which day had the highest number of cancelled flights due to the most serious reasons in Dallas/Fort Worth International?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.FL_DATE FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International' AND T2.ORIGIN = 'DFW' AND T2.CANCELLED = 1 AND T2.CANCELLATION_CODE = 'A' GROUP BY T2.FL_DATE ORDER BY COUNT(T2.FL_DATE) DESC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.FL_DATE FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International' AND T2.ORIGIN = 'DFW' AND T2.CANCELLED = 1 AND T2.CANCELLATION_CODE = 'A' GROUP BY T2.FL_DATE ORDER BY COUNT(T2.FL_DATE) DESC LIMIT 1", "index": 2871, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['HAD', 'DUE', 'MAX', 'DAY', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN text, -- example: ['DAY', 'JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST text, -- destination, example: ['DAY', 'PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOn August 2018 refers to FL_DATE like '2018/8%'; day with the highest number of cancelled flights refers to MAX(COUNT(FL_DATE WHERE CANCELLED = 1)); cancelled due to the most serious reasons refers to CANCELLATION_CODE = 'A'; in Dallas/Fort Worth International refers to Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International';\nOn August 2018, which day had the highest number of cancelled flights due to the most serious reasons in Dallas/Fort Worth International?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Bakersfield, CA: Meadows Field', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ntail number refers to TAIL_NUM; arrived on time refers to ARR_DELAY < = 0; Meadows Field airport refers to Description = 'Bakersfield, CA: Meadows Field'; in August of 2018 refers to FL_DATE like '2018/8%';\nList the tail numbers of all the aircraft that arrived on time at Meadows Field airport in August of 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.TAIL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Bakersfield, CA: Meadows Field' AND T2.DEST = 'BFL' AND T2.ARR_DELAY <= 0 GROUP BY T2.TAIL_NUM", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.TAIL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Bakersfield, CA: Meadows Field' AND T2.DEST = 'BFL' AND T2.ARR_DELAY <= 0 GROUP BY T2.TAIL_NUM", "index": 2872, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Bakersfield, CA: Meadows Field', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ntail number refers to TAIL_NUM; arrived on time refers to ARR_DELAY < = 0; Meadows Field airport refers to Description = 'Bakersfield, CA: Meadows Field'; in August of 2018 refers to FL_DATE like '2018/8%';\nList the tail numbers of all the aircraft that arrived on time at Meadows Field airport in August of 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['MAX', 'DUE', '01A', '03A']\n Description text, -- example: ['Boston, MA: Logan International', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ndestination refers to DEST; Logan International refers to Description = 'Boston, MA: Logan International'; airline id of the carrier operator refers to OP_CARRIER_AIRLINE_ID; highest delay in minutes due to security refers to MAX(SECURITY_DELAY);\nAmong the airports whose destination is Logan International, what is the airline id of the carrier operator with the highest delay in minutes due to security?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.OP_CARRIER_AIRLINE_ID FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T1.Description = 'Boston, MA: Logan International' AND T2.DEST = 'BOS' ORDER BY T2.SECURITY_DELAY DESC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.OP_CARRIER_AIRLINE_ID FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T1.Description = 'Boston, MA: Logan International' AND T2.DEST = 'BOS' ORDER BY T2.SECURITY_DELAY DESC LIMIT 1", "index": 2873, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['MAX', 'DUE', '01A', '03A']\n Description text, -- example: ['Boston, MA: Logan International', 'Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ndestination refers to DEST; Logan International refers to Description = 'Boston, MA: Logan International'; airline id of the carrier operator refers to OP_CARRIER_AIRLINE_ID; highest delay in minutes due to security refers to MAX(SECURITY_DELAY);\nAmong the airports whose destination is Logan International, what is the airline id of the carrier operator with the highest delay in minutes due to security?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['TOP', 'MAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the airlines refers to Description; highest number of aircraft refers to MAX(COUNT(TAIL_NUM));\nWhat are the names of the top 5 airlines with the highest number of aircraft?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code GROUP BY T2.Description ORDER BY T1.TAIL_NUM DESC LIMIT 5", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code GROUP BY T2.Description ORDER BY T1.TAIL_NUM DESC LIMIT 5", "index": 2874, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['TOP', 'MAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the airlines refers to Description; highest number of aircraft refers to MAX(COUNT(TAIL_NUM));\nWhat are the names of the top 5 airlines with the highest number of aircraft?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N202NN', 'N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nname of the airline refers to Description; tail number refers to TAIL_NUM; TAIL_NUM = 'N202NN';\nGive the name of the airline to which tail number N202NN 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 T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.TAIL_NUM = 'N202NN' GROUP BY T2.Description", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.TAIL_NUM = 'N202NN' GROUP BY T2.Description", "index": 2875, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N202NN', 'N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nname of the airline refers to Description; tail number refers to TAIL_NUM; TAIL_NUM = 'N202NN';\nGive the name of the airline to which tail number N202NN 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 Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['ABQ', 'LAX', 'JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['ABQ', 'LAX', 'PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Compass Airlines: CP', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['MAX', 'ABQ', 'LAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\ntail number refers to TAIL_NUM; Compass Airline refers to Description = 'Compass Airlines: CP'; flew the most number of lights from LAX TO ABQ refers to MAX(COUNT(OP_CARRIER_AIRLINE_ID WHERE ORIGIN = 'LAX' and DEST = 'ABQ')); from LAX refers to ORIGIN = 'LAX'; to ABQ refers to DEST = 'ABQ';\nWhat is the tail number of a Compass Airline's plane that flew the most number of flights from LAX to ABQ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.OP_CARRIER_AIRLINE_ID FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Compass Airlines: CP' AND T2.ORIGIN = 'LAX' AND T2.DEST = 'ABQ' GROUP BY T2.OP_CARRIER_AIRLINE_ID ORDER BY COUNT(T2.OP_CARRIER_AIRLINE_ID) DESC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.OP_CARRIER_AIRLINE_ID FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Compass Airlines: CP' AND T2.ORIGIN = 'LAX' AND T2.DEST = 'ABQ' GROUP BY T2.OP_CARRIER_AIRLINE_ID ORDER BY COUNT(T2.OP_CARRIER_AIRLINE_ID) DESC LIMIT 1", "index": 2876, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['ABQ', 'LAX', 'JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['ABQ', 'LAX', 'PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Compass Airlines: CP', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['MAX', 'ABQ', 'LAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\ntail number refers to TAIL_NUM; Compass Airline refers to Description = 'Compass Airlines: CP'; flew the most number of lights from LAX TO ABQ refers to MAX(COUNT(OP_CARRIER_AIRLINE_ID WHERE ORIGIN = 'LAX' and DEST = 'ABQ')); from LAX refers to ORIGIN = 'LAX'; to ABQ refers to DEST = 'ABQ';\nWhat is the tail number of a Compass Airline's plane that flew the most number of flights from LAX to ABQ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/8', '2018/8/2', '2018/8/1']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Delta Air Lines Inc.: DL', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'MAX', 'DUE', 'INC', 'SUM', '01A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nhours in total = DIVIDE(SUM(LATE_AIRCRAFT_DELAY), 60); Delta Air Lines refers to Description = 'Delta Air Lines Inc.: DL'; delayed due to a late aircraft refers to LATE_AIRCRAFT_DELAY; in August of 2018 refers to FL_DATE like '2018/8/%'; plane number refers to TAIL_NUM; highest delayed hours refers to MAX(DIVIDE(SUM(LATE_AIRCRAFT_DELAY),60));\nHow many hours in total did all of the Delta Air Lines aircraft were delayed due to a late aircraft in August of 2018? Identify the plane number of the aircraft with the highest delayed hours.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TAIL_NUM, SUM(CAST(T1.LATE_AIRCRAFT_DELAY AS REAL) / 60) AS delay FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T2.Code = T1.OP_CARRIER_AIRLINE_ID WHERE T1.FL_DATE LIKE '2018/8/%' AND T2.Description = 'Delta Air Lines Inc.: DL' ORDER BY delay DESC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.TAIL_NUM, SUM(CAST(T1.LATE_AIRCRAFT_DELAY AS REAL) / 60) AS delay FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T2.Code = T1.OP_CARRIER_AIRLINE_ID WHERE T1.FL_DATE LIKE '2018/8/%' AND T2.Description = 'Delta Air Lines Inc.: DL' ORDER BY delay DESC LIMIT 1", "index": 2877, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/8', '2018/8/2', '2018/8/1']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Delta Air Lines Inc.: DL', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'MAX', 'DUE', 'INC', 'SUM', '01A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nhours in total = DIVIDE(SUM(LATE_AIRCRAFT_DELAY), 60); Delta Air Lines refers to Description = 'Delta Air Lines Inc.: DL'; delayed due to a late aircraft refers to LATE_AIRCRAFT_DELAY; in August of 2018 refers to FL_DATE like '2018/8/%'; plane number refers to TAIL_NUM; highest delayed hours refers to MAX(DIVIDE(SUM(LATE_AIRCRAFT_DELAY),60));\nHow many hours in total did all of the Delta Air Lines aircraft were delayed due to a late aircraft in August of 2018? Identify the plane number of the aircraft with the highest delayed hours.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CARRIER_DELAY integer, -- example: [9, 0]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nPlease list any three airports with their codes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Code, Description FROM Airports LIMIT 3", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Code, Description FROM Airports LIMIT 3", "index": 2878, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CARRIER_DELAY integer, -- example: [9, 0]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nPlease list any three airports with their codes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n WEATHER_DELAY integer, -- example: [0, 2]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMississippi Valley Airlines refers to Description like 'Mississippi Valley Airlines%';\nWhat is the code of Mississippi Valley Airlines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Code FROM `Air Carriers` WHERE Description LIKE 'Mississippi Valley Airlines%'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Code FROM `Air Carriers` WHERE Description LIKE 'Mississippi Valley Airlines%'", "index": 2879, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n WEATHER_DELAY integer, -- example: [0, 2]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMississippi Valley Airlines refers to Description like 'Mississippi Valley Airlines%';\nWhat is the code of Mississippi Valley Airlines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['SNA', 'DFW', 'JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST text, -- destination, example: ['SNA', 'DFW', 'PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'SNA', 'ANA', 'DFW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nfrom Dallas refers to ORIGIN = 'DFW'; to Santa Ana refers to DEST = 'SNA'; departed on time refers to DEP_DELAY = 0;\nHow many flights from Dallas to Santa Ana departed on time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM Airlines WHERE DEST = 'SNA' AND ORIGIN = 'DFW' AND DEP_DELAY = 0", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM Airlines WHERE DEST = 'SNA' AND ORIGIN = 'DFW' AND DEP_DELAY = 0", "index": 2880, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['SNA', 'DFW', 'JFK', 'PHX']\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST text, -- destination, example: ['SNA', 'DFW', 'PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', 'SNA', 'ANA', 'DFW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nfrom Dallas refers to ORIGIN = 'DFW'; to Santa Ana refers to DEST = 'SNA'; departed on time refers to DEP_DELAY = 0;\nHow many flights from Dallas to Santa Ana departed on time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['A11', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nWhat is the airport description of the airport code A11?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Description FROM Airports WHERE Code = 'A11'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Description FROM Airports WHERE Code = 'A11'", "index": 2881, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['A11', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nWhat is the airport description of the airport code A11?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['OKC', '01A', '03A']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN text, -- example: ['OKC', 'JFK', 'PHX']\n DEST text, -- destination, example: ['OKC', 'PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOklahoma as origin refers to Origin = 'OKC';\nWhat is the total number of flights that have Oklahoma as their origin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) AS num FROM Airlines WHERE Origin = 'OKC'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) AS num FROM Airlines WHERE Origin = 'OKC'", "index": 2882, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['OKC', '01A', '03A']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN text, -- example: ['OKC', 'JFK', 'PHX']\n DEST text, -- destination, example: ['OKC', 'PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOklahoma as origin refers to Origin = 'OKC';\nWhat is the total number of flights that have Oklahoma as their origin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['END', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ncode that ends with number 3 refers to Code like '%3';\nList the description of the airports that have code that ends with number 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Description FROM Airports WHERE Code LIKE '%3'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT Description FROM Airports WHERE Code LIKE '%3'", "index": 2883, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['END', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ncode that ends with number 3 refers to Code like '%3';\nList the description of the airports that have code that ends with number 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['GWE', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Ross Aviation Inc.: GWE', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ndate of flight refers to FL_DATE; tail number of flight refers to TAIL_NUM; Ross Aviation Inc.: GWE refers to Description = 'Ross Aviation Inc.: GWE';\nProvide the date and tail number of flight with air carrier \"Ross Aviation Inc.: GWE\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.FL_DATE, T1.TAIL_NUM FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T2.Description = 'Ross Aviation Inc.: GWE'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.FL_DATE, T1.TAIL_NUM FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T2.Description = 'Ross Aviation Inc.: GWE'", "index": 2884, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['GWE', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Ross Aviation Inc.: GWE', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\ndate of flight refers to FL_DATE; tail number of flight refers to TAIL_NUM; Ross Aviation Inc.: GWE refers to Description = 'Ross Aviation Inc.: GWE';\nProvide the date and tail number of flight with air carrier \"Ross Aviation Inc.: GWE\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['MIN', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nshortest arrival time refers to MIN(ARR_TIME);\nList the air carrier description and code of the flight with the shortest arrival time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Description, T1.Code FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ARR_TIME ASC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.Description, T1.Code FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ARR_TIME ASC LIMIT 1", "index": 2885, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST text, -- destination, example: ['PHX', 'EWR']\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['MIN', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\nshortest arrival time refers to MIN(ARR_TIME);\nList the air carrier description and code of the flight with the shortest arrival time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['MIA', 'JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['MIA', 'PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['MIA', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\narriving at Miami refers to DEST = 'MIA';\nProvide the air carrier description of all flights arriving at Miami.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'MIA'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'MIA'", "index": 2886, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['MIA', 'JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['MIA', 'PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['MIA', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\narriving at Miami refers to DEST = 'MIA';\nProvide the air carrier description of all flights arriving at Miami.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['SEM', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Semo Aviation Inc.: SEM', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactual elapsed time refers to ACTUAL_ELAPSED_TIME; Semo Aviation Inc.: SEM. Refers to Description = 'Semo Aviation Inc.: SEM';\nGive the actual elapsed time of the flights with air carrier named Semo Aviation Inc.: SEM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ACTUAL_ELAPSED_TIME FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Semo Aviation Inc.: SEM'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.ACTUAL_ELAPSED_TIME FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Semo Aviation Inc.: SEM'", "index": 2887, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['SEM', 'INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Semo Aviation Inc.: SEM', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactual elapsed time refers to ACTUAL_ELAPSED_TIME; Semo Aviation Inc.: SEM. Refers to Description = 'Semo Aviation Inc.: SEM';\nGive the actual elapsed time of the flights with air carrier named Semo Aviation Inc.: SEM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n0 departure delay refers to DEP_DELAY = 0;\nList the air carrier's description of the flights with 0 departure delay.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEP_DELAY = 0 GROUP BY T1.Description", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEP_DELAY = 0 GROUP BY T1.Description", "index": 2888, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n0 departure delay refers to DEP_DELAY = 0;\nList the air carrier's description of the flights with 0 departure delay.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['MAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nhighest actual elapsed time refers to MAX(ACTUAL_ELAPSED_TIME);\nProvide the air carrier description of the flight with the highest actual elapsed time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ACTUAL_ELAPSED_TIME DESC LIMIT 1", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ACTUAL_ELAPSED_TIME DESC LIMIT 1", "index": 2889, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['MAX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nhighest actual elapsed time refers to MAX(ACTUAL_ELAPSED_TIME);\nProvide the air carrier description of the flight with the highest actual elapsed time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/20', '2018/8/10', '2018/8/2', '2018/8/1', '2018/8/18', '2018/8/17']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Spirit Air Lines: NK', 'Trans Southern Airways: PDA', 'Southern Airways: FTI', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nFrom August 10 to August 20, 2018 refers to FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'; cancelled flights refers to CANCELLED = 1; Trans Southern Airways: 'Spirit Air Lines: NK' refers to Description = 'Spirit Air Lines: NK';\nFrom August 10 to August 20, 2018, how many cancelled flights of air carrier named Spirit Air Lines: NK are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Spirit Air Lines: NK' AND T2.CANCELLED = 0 AND T2.FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Spirit Air Lines: NK' AND T2.CANCELLED = 0 AND T2.FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'", "index": 2890, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/20', '2018/8/10', '2018/8/2', '2018/8/1', '2018/8/18', '2018/8/17']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Spirit Air Lines: NK', 'Trans Southern Airways: PDA', 'Southern Airways: FTI', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\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:\nFrom August 10 to August 20, 2018 refers to FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'; cancelled flights refers to CANCELLED = 1; Trans Southern Airways: 'Spirit Air Lines: NK' refers to Description = 'Spirit Air Lines: NK';\nFrom August 10 to August 20, 2018, how many cancelled flights of air carrier named Spirit Air Lines: NK are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/2', '2018/8/8', '2018/8/1']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\non August 2, 2018 refers to FL_DATE = '2018/8/2'; Horizon Air refers to Description which includs 'Horizon Air';\nWhat is the total number of flights that flew on August 2, 2018 with air carrier described as Horizon Air?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Horizon Air%' AND T2.FL_DATE = '2018/8/2'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Horizon Air%' AND T2.FL_DATE = '2018/8/2'", "index": 2891, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/2', '2018/8/8', '2018/8/1']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\non August 2, 2018 refers to FL_DATE = '2018/8/2'; Horizon Air refers to Description which includs 'Horizon Air';\nWhat is the total number of flights that flew on August 2, 2018 with air carrier described as Horizon Air?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Iscargo Hf: ICQ', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\ntail number refers to TAIL_NUM; Iscargo Hf: ICQ refers to Description = 'Iscargo Hf: ICQ'; arrival time of 1000 and below refers to ARR_TIME < = 1000;\nWhat is the tail number of the flight with air carrier named Iscargo Hf: ICQ and arrival time of 1000 and below?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_TIME <= 1000 AND T1.Description = 'Iscargo Hf: ICQ'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_TIME <= 1000 AND T1.Description = 'Iscargo Hf: ICQ'", "index": 2892, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Iscargo Hf: ICQ', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\ntail number refers to TAIL_NUM; Iscargo Hf: ICQ refers to Description = 'Iscargo Hf: ICQ'; arrival time of 1000 and below refers to ARR_TIME < = 1000;\nWhat is the tail number of the flight with air carrier named Iscargo Hf: ICQ and arrival time of 1000 and below?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Profit Airlines Inc.: XBH', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nflight date refers to FL_DATE; Profit Airlines Inc.: XBH refers to Description = 'Profit Airlines Inc.: XBH'; actual elapsed time below 100 refers to ACTUAL_ELAPSED_TIME < 100;\nList the flight date of flights with air carrier described as Profit Airlines Inc.: XBH which have an actual elapsed time below 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 T2.FL_DATE FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ACTUAL_ELAPSED_TIME < 100 AND T1.Description = 'Profit Airlines Inc.: XBH'", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T2.FL_DATE FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ACTUAL_ELAPSED_TIME < 100 AND T1.Description = 'Profit Airlines Inc.: XBH'", "index": 2893, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Profit Airlines Inc.: XBH', 'Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['INC', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nflight date refers to FL_DATE; Profit Airlines Inc.: XBH refers to Description = 'Profit Airlines Inc.: XBH'; actual elapsed time below 100 refers to ACTUAL_ELAPSED_TIME < 100;\nList the flight date of flights with air carrier described as Profit Airlines Inc.: XBH which have an actual elapsed time below 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 Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepublic Airline refers to Description which contains 'Republic Airline'; departure delay of 30 minutes and above refers to DEP_DELAY > 30;\nAmong the flights with air carrier named Republic Airline, how many of the flights have departure delay of 30 minutes and above?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Republic Airline%' AND T2.DEP_DELAY > 30", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Republic Airline%' AND T2.DEP_DELAY > 30", "index": 2894, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Airports (\n Code text, -- example: ['HOW', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepublic Airline refers to Description which contains 'Republic Airline'; departure delay of 30 minutes and above refers to DEP_DELAY > 30;\nAmong the flights with air carrier named Republic Airline, how many of the flights have departure delay of 30 minutes and above?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/25', '2018/8/2', '2018/8/5', '2018/8/8', '2018/8/1']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\non August 25, 2018 refers to FL_DATE = '2018/8/25'; departure delay of -5 refers to DEP_DELAY = -5;\nWhat are the air carriers of the flights that flew on August 25, 2018 that have departure delay of -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.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.FL_DATE = '2018/8/25' GROUP BY T1.Description", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.FL_DATE = '2018/8/25' GROUP BY T1.Description", "index": 2895, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/25', '2018/8/2', '2018/8/5', '2018/8/8', '2018/8/1']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_AIRPORT_SEQ_ID integer, -- origin airport sequence id, example: [1247805, 1410702]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['JFK', 'PHX']\n DEST_AIRPORT_ID integer, -- destination airport id, example: [14107, 11618]\n DEST_AIRPORT_SEQ_ID integer, -- destination airport sequence id, example: [1410702, 1161802]\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n CRS_DEP_TIME integer, -- scheduled local departure time, example: [1640, 1512]\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n DEP_DELAY_NEW integer, -- departure delay new, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLED integer, -- example: [0, 1]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n NAS_DELAY integer, -- National Aviavtion System delay, example: [35, 53]\n SECURITY_DELAY integer, -- example: [0, 42]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\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:\non August 25, 2018 refers to FL_DATE = '2018/8/25'; departure delay of -5 refers to DEP_DELAY = -5;\nWhat are the air carriers of the flights that flew on August 25, 2018 that have departure delay of -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 `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['PHX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['PHX', 'JFK']\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\narrival time lower than the 40% of the average arrival time refers to ARR_TIME < MULTIPLY(AVG(ARR_TIME), 0.4); flew to Phoenix refers to DEST = 'PHX';\nList the air carrier's description with arrival time lower than the 40% of the average arrival time of flights that flew to Phoenix.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'PHX' AND T2.ARR_TIME < ( SELECT AVG(ARR_TIME) * 0.4 FROM Airlines ) GROUP BY T1.Description", "style": "rule" }
{ "db_id": "airline.sqlite", "gt_sql": "SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'PHX' AND T2.ARR_TIME < ( SELECT AVG(ARR_TIME) * 0.4 FROM Airlines ) GROUP BY T1.Description", "index": 2896, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Air Carriers` (\n Code integer, -- example: [19031, 19032]\n Description text, -- example: ['Mackey International Inc.: MAC', 'Munz Northern Airlines Inc.: XY']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airports (\n Code text, -- example: ['PHX', '01A', '03A']\n Description text, -- example: ['Afognak Lake, AK: Afognak Lake Airport', 'Granite Mountain, AK: Bear Creek Mining ']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE Airlines (\n FL_DATE text, -- flight date, example: ['2018/8/1', '2018/8/2']\n OP_CARRIER_AIRLINE_ID integer, -- operator carrier airline id, example: [19805, 20427]\n TAIL_NUM text, -- tail number, example: ['N956AN', 'N973AN']\n OP_CARRIER_FL_NUM integer, -- operator carrier flight number, example: [1587, 1588]\n ORIGIN_AIRPORT_ID integer, -- example: [12478, 14107]\n ORIGIN_CITY_MARKET_ID integer, -- example: [31703, 30466]\n ORIGIN text, -- example: ['PHX', 'JFK']\n DEST_CITY_MARKET_ID integer, -- destination city market id, example: [30466, 31703]\n DEST text, -- destination, example: ['PHX', 'EWR']\n DEP_TIME integer, -- departure time, example: [1649, 1541]\n DEP_DELAY integer, -- Departure delay, example: [9, 29]\n ARR_TIME integer, -- arrival time, example: [2006, 2350]\n ARR_DELAY integer, -- arrival delay, example: [44, 53]\n ARR_DELAY_NEW integer, -- arrival delay new, example: [44, 53]\n CANCELLATION_CODE text, -- example: ['A', 'B']\n CRS_ELAPSED_TIME integer, -- scheduled elapsed time, example: [342, 285]\n ACTUAL_ELAPSED_TIME integer, -- example: [377, 309]\n CARRIER_DELAY integer, -- example: [9, 0]\n WEATHER_DELAY integer, -- example: [0, 2]\n LATE_AIRCRAFT_DELAY integer, -- example: [0, 6]\n CONSTRAINT fk_airlines_op_carrier_airline_id FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES `Air Carriers` (Code),\n CONSTRAINT fk_airlines_origin FOREIGN KEY (ORIGIN) REFERENCES Airports (Code),\n CONSTRAINT fk_airlines_dest FOREIGN KEY (DEST) REFERENCES Airports (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\narrival time lower than the 40% of the average arrival time refers to ARR_TIME < MULTIPLY(AVG(ARR_TIME), 0.4); flew to Phoenix refers to DEST = 'PHX';\nList the air carrier's description with arrival time lower than the 40% of the average arrival time of flights that flew to Phoenix.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks have over 500 pages refers to num_pages > 500\nAmong the books published by publisher ID 1929, how many of them have over 500 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM book WHERE publisher_id = 1929 AND num_pages > 500", "style": "rule" }
{ "db_id": "books.sqlite", "gt_sql": "SELECT COUNT(*) FROM book WHERE publisher_id = 1929 AND num_pages > 500", "index": 2897, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks have over 500 pages refers to num_pages > 500\nAmong the books published by publisher ID 1929, how many of them have over 500 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbook with the most pages refers to Max(num_pages)\nWhat is the publication date of the book with the most pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT publication_date FROM book ORDER BY num_pages DESC LIMIT 1", "style": "rule" }
{ "db_id": "books.sqlite", "gt_sql": "SELECT publication_date FROM book ORDER BY num_pages DESC LIMIT 1", "index": 2898, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbook with the most pages refers to Max(num_pages)\nWhat is the publication date of the book with the most pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Illuminati', 'The Names', \"The World's First Love: Mary Mother of \"]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"The Illuminati\" is the title of the book; name of publisher refers to publisher_name\nWhat is the name of the publisher of the book \"The Illuminati\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Illuminati'", "style": "rule" }
{ "db_id": "books.sqlite", "gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Illuminati'", "index": 2899, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Illuminati', 'The Names', \"The World's First Love: Mary Mother of \"]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"The Illuminati\" is the title of the book; name of publisher refers to publisher_name\nWhat is the name of the publisher of the book \"The Illuminati\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }