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 `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest grossing movie without song refers to movie_title where MAX(total_gross) and song = 'null';\nWhat is the highest grossing movie without a song?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.song IS NULL ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.song IS NULL ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2300, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest grossing movie without song refers to movie_title where MAX(total_gross) and song = 'null';\nWhat is the highest grossing movie without a song?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Nov 24, 2010', 'Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCame out on 11/24/2010 refers to release_date = 'Nov 24, 2010';\nWho are the voice actors in the movie that came out on 11/24/2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.`voice-actor` FROM movies_total_gross AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T1.release_date = 'Nov 24, 2010'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.`voice-actor` FROM movies_total_gross AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T1.release_date = 'Nov 24, 2010'", "index": 2301, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Nov 24, 2010', 'Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCame out on 11/24/2010 refers to release_date = 'Nov 24, 2010';\nWho are the voice actors in the movie that came out on 11/24/2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Jim Cummings', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat are the total grosses for the movies with Jim Cummings as the voice actor?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM `voice-actors` AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie WHERE T1.`voice-actor` = 'Jim Cummings' ORDER BY CAST(REPLACE(trim(T2.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.movie_title FROM `voice-actors` AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie WHERE T1.`voice-actor` = 'Jim Cummings' ORDER BY CAST(REPLACE(trim(T2.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2302, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Jim Cummings', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat are the total grosses for the movies with Jim Cummings as the voice actor?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased in 2016 refers to substr(release_date, length(release_date) - 3, length(release_date)) = '2016'; movies refer to the movie_title;\nList the movies and genres released in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT movie_title, genre FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '2016'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT movie_title, genre FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '2016'", "index": 2303, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased in 2016 refers to substr(release_date, length(release_date) - 3, length(release_date)) = '2016'; movies refer to the movie_title;\nList the movies and genres released in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWolfgang Reitherman refers to director = 'Wolfgang Reitherman'; 1997 refers to substr(release_date, length(release_date) - 3, length(release_date)) = '1977'; the titles refer to movie_title; main characters refer to hero;\nProvide the titles, main characters, and associated songs of the movies directed by Wolfgang Reitherman in 1977.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movie_title, T2.hero, T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T1.movie_title = T3.name WHERE T3.director = 'Wolfgang Reitherman' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) = '1977'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title, T2.hero, T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T1.movie_title = T3.name WHERE T3.director = 'Wolfgang Reitherman' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) = '1977'", "index": 2304, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWolfgang Reitherman refers to director = 'Wolfgang Reitherman'; 1997 refers to substr(release_date, length(release_date) - 3, length(release_date)) = '1977'; the titles refer to movie_title; main characters refer to hero;\nProvide the titles, main characters, and associated songs of the movies directed by Wolfgang Reitherman in 1977.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Donald Duck', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Donald Duck', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDonald Duck is the main character of the movie which refers to hero = 'Donald Duck'; movies refer to movie_title; who directed refers director;\nWhich movies had the main character named Donald Duck and who directed 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.movie_title, T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.hero = 'Donald Duck'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title, T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.hero = 'Donald Duck'", "index": 2305, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Donald Duck', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Donald Duck', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDonald Duck is the main character of the movie which refers to hero = 'Donald Duck'; movies refer to movie_title; who directed refers director;\nWhich movies had the main character named Donald Duck and who directed 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 `voice-actors` (\n `character` text, -- example: ['Mulan', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Mulan', 'Mulan 2', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Mulan', 'Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Mulan', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Mulan', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['Mulan', '101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMulan refers to movie_title = 'Mulan';\nDescribe the hero, director, and the release date of Mulan.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.hero, T2.director, T1.release_date FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.movie_title = 'Mulan'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.hero, T2.director, T1.release_date FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.movie_title = 'Mulan'", "index": 2306, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Mulan', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Mulan', 'Mulan 2', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Mulan', 'Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Mulan', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Mulan', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['Mulan', '101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMulan refers to movie_title = 'Mulan';\nDescribe the hero, director, and the release date of Mulan.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Freddie Jones', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFreddie Jones refers to voice-actor = 'Freddie Jones'; title refers to movie_title;\nProvide the title, director, and release date of the movie voice-acted by Freddie Jones.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movie, T3.director, T2.release_date FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T3.name = T2.movie_title WHERE T1.`voice-actor` = 'Freddie Jones'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie, T3.director, T2.release_date FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T3.name = T2.movie_title WHERE T1.`voice-actor` = 'Freddie Jones'", "index": 2307, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Freddie Jones', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFreddie Jones refers to voice-actor = 'Freddie Jones'; title refers to movie_title;\nProvide the title, director, and release date of the movie voice-acted by Freddie Jones.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe most popular movie refers MAX(total_gross); who directed refers to director;\nWho directed the most popular movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2308, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe most popular movie refers MAX(total_gross); who directed refers to director;\nWho directed the most popular movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLion King refers to movie_title = 'Lion King';\nWho is the voice actor of the hero in Lion King?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.`voice-actor` FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title WHERE T2.movie_title = 'Lion King' AND T1.character = 'Lion King'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.`voice-actor` FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title WHERE T2.movie_title = 'Lion King' AND T1.character = 'Lion King'", "index": 2309, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLion King refers to movie_title = 'Lion King';\nWho is the voice actor of the hero in Lion King?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Comedy', 'Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(movie_title where genre = 'Comedy'), COUNT(movie_title)) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) between '1991' and '2000';\nAmong the movies released from 1991 to 2000, calculate the percentage of comedy movies. Provide any five movie titles and directors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.genre = 'Comedy' THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title), group_concat(T1.movie_title), group_concat(T2.director) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '1991' AND '2000'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.genre = 'Comedy' THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title), group_concat(T1.movie_title), group_concat(T2.director) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '1991' AND '2000'", "index": 2310, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Comedy', 'Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(movie_title where genre = 'Comedy'), COUNT(movie_title)) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) between '1991' and '2000';\nAmong the movies released from 1991 to 2000, calculate the percentage of comedy movies. Provide any five movie titles and directors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['Hercules', '101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Hercules', 'Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Hercules', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Hercules', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Calliope', 'Hercules', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Hercules', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHercules refers to movie = 'Hercules';\nName the voice actor of the character Calliope in the movie Hercules.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT `voice-actor` FROM `voice-actors` WHERE movie = 'Hercules' AND character = 'Calliope'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT `voice-actor` FROM `voice-actors` WHERE movie = 'Hercules' AND character = 'Calliope'", "index": 2311, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['Hercules', '101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Hercules', 'Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Hercules', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Hercules', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Calliope', 'Hercules', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Hercules', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHercules refers to movie = 'Hercules';\nName the voice actor of the character Calliope in the movie Hercules.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Aladdin', 'Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Aladdin', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Aladdin', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['Aladdin', '101 Dalmatians']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Aladdin', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAladdin is the name of the movie which refers to movie = 'Aladdin';\nHow many voice actors for the movie Aladdin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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('voice-actor') FROM `voice-actors` WHERE movie = 'Aladdin'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT COUNT('voice-actor') FROM `voice-actors` WHERE movie = 'Aladdin'", "index": 2312, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Aladdin', 'Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Aladdin', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Aladdin', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['Aladdin', '101 Dalmatians']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Aladdin', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAladdin is the name of the movie which refers to movie = 'Aladdin';\nHow many voice actors for the movie Aladdin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Jeff Bennett', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJeff Bennett refers to voice-actor = 'Jeff Bennett';\nList the movie titles with the voice actor Jeff Bennet\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT movie FROM `voice-actors` WHERE 'voice-actor' = 'Jeff Bennett'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT movie FROM `voice-actors` WHERE 'voice-actor' = 'Jeff Bennett'", "index": 2313, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Jeff Bennett', 'Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJeff Bennett refers to voice-actor = 'Jeff Bennett';\nList the movie titles with the voice actor Jeff Bennet\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Jack', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Jack Kinney', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat movies did director Jack Kinney direct?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT name FROM director WHERE director = 'Jack Kinney'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT name FROM director WHERE director = 'Jack Kinney'", "index": 2314, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Jack', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Jack Kinney', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat movies did director Jack Kinney direct?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Ben', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Ben Sharpsteen', 'David Hand']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBen Sharpsteen refers to director = 'Ben Sharpsteen';\nProvide the name of the song from the movie directed by Ben Sharpsteen.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.song FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Ben Sharpsteen'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.song FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Ben Sharpsteen'", "index": 2315, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Ben', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Ben Sharpsteen', 'David Hand']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBen Sharpsteen refers to director = 'Ben Sharpsteen';\nProvide the name of the song from the movie directed by Ben Sharpsteen.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhich movies do not have villain refer to movie_title where villian is null;\nWhich movies of director Wolfgang Reitherman do not have villain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movie_title FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' AND T1.villian IS NULL", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' AND T1.villian IS NULL", "index": 2316, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Wolfgang Reitherman', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhich movies do not have villain refer to movie_title where villian is null;\nWhich movies of director Wolfgang Reitherman do not have villain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe highest total gross refers to MAX(total_gross);\nWhich movie's song title has the highest total gross?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2317, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe highest total gross refers to MAX(total_gross);\nWhich movie's song title has the highest total gross?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1937 to 1990 refers to substr(release_date, length(release_date) - 3, length(release_date)) between '1937' and '1990'; the most popular film refers to movie_title where MAX(total_gross);\nWhich director had the most popular film from 1937 to 1990?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name INNER JOIN movies_total_gross AS T3 ON T3.movie_title = T1.movie_title WHERE SUBSTR(T3.release_date, LENGTH(T3.release_date) - 3, LENGTH(T3.release_date)) BETWEEN '1937' AND '1990' ORDER BY CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name INNER JOIN movies_total_gross AS T3 ON T3.movie_title = T1.movie_title WHERE SUBSTR(T3.release_date, LENGTH(T3.release_date) - 3, LENGTH(T3.release_date)) BETWEEN '1937' AND '1990' ORDER BY CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2318, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1937 to 1990 refers to substr(release_date, length(release_date) - 3, length(release_date)) between '1937' and '1990'; the most popular film refers to movie_title where MAX(total_gross);\nWhich director had the most popular film from 1937 to 1990?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Taran', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Taran', 'Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTaran is the main character of the movie which refers to hero = 'Taran';\nWhat genre of movie has Taran as the main character?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.genre FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T2.hero = 'Taran'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.genre FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T2.hero = 'Taran'", "index": 2319, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Taran', 'Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Taran', 'Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTaran is the main character of the movie which refers to hero = 'Taran';\nWhat genre of movie has Taran as the main character?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe first movie released refers to movie_title where substr(release_date, length(release_date) - 1, length(release_date)) asc limit 1;\nName the first movie released by Disney.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT movie_title FROM characters ORDER BY SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) ASC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT movie_title FROM characters ORDER BY SUBSTR(release_date, LENGTH(release_date) - 1, LENGTH(release_date)) ASC LIMIT 1", "index": 2320, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe first movie released refers to movie_title where substr(release_date, length(release_date) - 1, length(release_date)) asc limit 1;\nName the first movie released by Disney.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Action', 'Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naction movie refers to movie_title where genre = 'Action'; highest grossing movie refers to MAX(total_gross)\nWhat is Disney's highest grossing action movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT movie_title FROM movies_total_gross WHERE genre = 'Action' ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT movie_title FROM movies_total_gross WHERE genre = 'Action' ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2321, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Action', 'Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naction movie refers to movie_title where genre = 'Action'; highest grossing movie refers to MAX(total_gross)\nWhat is Disney's highest grossing action movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Akela', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['The Jungle Book', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['The Jungle Book', 'The Jungle Book 2', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['The Jungle Book', '101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['The Jungle Book', 'Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAkela refers character = 'Akela'; which actor voices refers to voice-actor;\nWhich actor voices Akela from The Jungle Book?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT `voice-actor` FROM `voice-actors` WHERE character = 'Akela'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT `voice-actor` FROM `voice-actors` WHERE character = 'Akela'", "index": 2322, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Akela', 'Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['The Jungle Book', 'Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['The Jungle Book', 'The Jungle Book 2', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['The Jungle Book', '101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['The Jungle Book', 'Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAkela refers character = 'Akela'; which actor voices refers to voice-actor;\nWhich actor voices Akela from The Jungle Book?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 2010 and 2016 refers to Year between 2010 and 2016;\nDetermine Disney's total box office gross between 2010 and 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(Total) FROM revenue WHERE `Year` BETWEEN 2010 AND 2016", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT SUM(Total) FROM revenue WHERE `Year` BETWEEN 2010 AND 2016", "index": 2323, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 2010 and 2016 refers to Year between 2010 and 2016;\nDetermine Disney's total box office gross between 2010 and 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Adventure', 'Musical']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nadventure movie refers to genre = 'Adventure'; the main character of the movie refers to hero; most popular movie based on its inflation-adjusted gross refers to where MAX(inflation_adjusted_gross);\nName the main character of Disney's most popular adventure movie based on its inflation-adjusted gross.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.hero FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Adventure' ORDER BY CAST(REPLACE(trim(T1.inflation_adjusted_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.hero FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Adventure' ORDER BY CAST(REPLACE(trim(T1.inflation_adjusted_gross, '$'), ',', '') AS REAL) DESC LIMIT 1", "index": 2324, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Adventure', 'Musical']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nadventure movie refers to genre = 'Adventure'; the main character of the movie refers to hero; most popular movie based on its inflation-adjusted gross refers to where MAX(inflation_adjusted_gross);\nName the main character of Disney's most popular adventure movie based on its inflation-adjusted gross.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['The Director', 'Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest grossing movie refers to movie_title where MIN(total_gross);\nName the director of Disney's lowest grossing movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) ASC LIMIT 1", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) ASC LIMIT 1", "index": 2325, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['The Director', 'Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest grossing movie refers to movie_title where MIN(total_gross);\nName the director of Disney's lowest grossing movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(Walt Disney Parks and Resorts where year = 2010), SUM(year = 2010) as percentage;\nFind out what proportion of total revenue Walt Disney Parks and Resorts received in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(`Walt Disney Parks and Resorts`) / SUM(Total) * 100 FROM revenue WHERE year = 2010", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT SUM(`Walt Disney Parks and Resorts`) / SUM(Total) * 100 FROM revenue WHERE year = 2010", "index": 2326, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(Walt Disney Parks and Resorts where year = 2010), SUM(year = 2010) as percentage;\nFind out what proportion of total revenue Walt Disney Parks and Resorts received in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(inflation_adjusted_gross, total_gross) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) = '1995';\nFind the estimated inflation rate that was used to adjust the 1995 box office revenue for Disney's films.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) / SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995' GROUP BY SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) / SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995' GROUP BY SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995'", "index": 2327, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(inflation_adjusted_gross, total_gross) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) = '1995';\nFind the estimated inflation rate that was used to adjust the 1995 box office revenue for Disney's films.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Cars 2', 'Cars', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(inflation_adjusted_gross where movie_title = 'Cars', inflation_adjusted_gross where movie_title = 'Cars 2'); more popular movie refers to movie_title where MAX(inflation_adjusted_gross);\nWhat is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 movie_title = 'Cars' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END), SUM(CASE WHEN movie_title = 'Cars 2' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) FROM movies_total_gross", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT SUM(CASE WHEN movie_title = 'Cars' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END), SUM(CASE WHEN movie_title = 'Cars 2' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) FROM movies_total_gross", "index": 2328, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['Cars 2', 'Cars', '101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n genre text, -- example: ['Musical', 'Adventure']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(inflation_adjusted_gross where movie_title = 'Cars', inflation_adjusted_gross where movie_title = 'Cars 2'); more popular movie refers to movie_title where MAX(inflation_adjusted_gross);\nWhat is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Chris Buck', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Buck', 'Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChris Buck refers to director = 'Chris Buck'; the most recent movie refers to movie_title where MAX(release_date); current gross refers to inflation_adjusted_gross; more successful movie refers to MAX(inflation_adjusted_gross);\nName the most recent movie directed by Chris Buck. Which of his movies was more successful in terms of grossing? Use the current gross for comparison.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movie_title, MAX(T1.release_date), MAX(T1.inflation_adjusted_gross) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Chris Buck'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT T1.movie_title, MAX(T1.release_date), MAX(T1.inflation_adjusted_gross) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Chris Buck'", "index": 2329, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Chris Buck', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n release_date text, -- example: ['21-Dec-37', '7-Feb-40']\n hero text, -- example: ['Snow White', 'Pinocchio']\n villian text, -- example: ['Evil Queen', 'Stromboli']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Buck', 'Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChris Buck refers to director = 'Chris Buck'; the most recent movie refers to movie_title where MAX(release_date); current gross refers to inflation_adjusted_gross; more successful movie refers to MAX(inflation_adjusted_gross);\nName the most recent movie directed by Chris Buck. Which of his movies was more successful in terms of grossing? Use the current gross for comparison.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe top 5 highest-grossing movies adjusted for inflation refer to MAX(inflation_adjusted_gross)LIMIT 5; DIVIDE(SUM(MAX(inflation_adjusted_gross LIMIT 5)), SUM(inflation_adjusted_gross)) as percentage;\nName the top 5 highest-grossing Disney movies adjusted for inflation. Identify the percentage they contributed to the total of Disney's current gross.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) > 1236035515 THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) * 100 / SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT SUM(CASE WHEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) > 1236035515 THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) * 100 / SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross", "index": 2330, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n inflation_adjusted_gross text, -- example: ['$5,228,953,251', '$2,188,229,052']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Walt Disney Parks and Resorts` real, -- example: [2794.0, 3306.0]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe top 5 highest-grossing movies adjusted for inflation refer to MAX(inflation_adjusted_gross)LIMIT 5; DIVIDE(SUM(MAX(inflation_adjusted_gross LIMIT 5)), SUM(inflation_adjusted_gross)) as percentage;\nName the top 5 highest-grossing Disney movies adjusted for inflation. Identify the percentage they contributed to the total of Disney's current gross.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Gary Trousdale', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(movie_title where director = 'Gary Trousdale' and total_gross > 100000000), COUNT(movie_title where director = 'Gary Trousdale')) as percentage;\nAmong all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Gary Trousdale'", "style": "rule" }
{ "db_id": "disney.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Gary Trousdale'", "index": 2331, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n movie_title text, -- example: ['Aladdin', 'Alice in Wonderland']\n hero text, -- example: ['Snow White', 'Pinocchio']\n song text, -- example: ['Some Day My Prince Will Come', 'When You Wish upon a Star']\n PRIMARY KEY (movie_title),\n CONSTRAINT fk_characters_hero FOREIGN KEY (hero) REFERENCES `voice-actors` (`character`)\n);\n\nCREATE TABLE director (\n name text, -- example: ['101 Dalmatians', 'Aladdin']\n director text, -- example: ['Gary Trousdale', 'David Hand', 'Ben Sharpsteen']\n PRIMARY KEY (name),\n CONSTRAINT fk_director_name FOREIGN KEY (name) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE `voice-actors` (\n `character` text, -- example: ['Abby Mallard', 'Abigail Gabble']\n `voice-actor` text, -- example: ['Joan Cusack', 'Monica Evans']\n movie text, -- example: ['Chicken Little', 'The Aristocats']\n PRIMARY KEY (`character`),\n CONSTRAINT fk_voice-actors_movie FOREIGN KEY (movie) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE movies_total_gross (\n movie_title text, -- example: ['101 Dalmatians', '102 Dalmatians']\n release_date text, -- example: ['Jan 25, 1961', 'Nov 27, 1996']\n MPAA_rating text, -- Motion Picture Association of America rating, example: ['G', 'Not Rated']\n total_gross text, -- example: ['$184,925,485', '$84,300,000']\n PRIMARY KEY (movie_title, release_date),\n CONSTRAINT fk_movies_total_gross_movie_title FOREIGN KEY (movie_title) REFERENCES characters (movie_title)\n);\n\nCREATE TABLE revenue (\n `Year` integer, -- example: [1991, 1992]\n `Studio Entertainment[NI 1]` real, -- example: [2593.0, 3115.0]\n `Disney Consumer Products[NI 2]` real, -- example: [724.0, 1081.0]\n `Disney Interactive[NI 3][Rev 1]` integer, -- example: [174, 260]\n `Disney Media Networks` text, -- example: ['359', '414']\n Total integer, -- example: [6111, 7502]\n PRIMARY KEY (`Year`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(movie_title where director = 'Gary Trousdale' and total_gross > 100000000), COUNT(movie_title where director = 'Gary Trousdale')) as percentage;\nAmong all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['All', 'C', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlegislators who do not have an account refers to cspan_id IS NULL OR cspan_id = ''\nPlease list the official full names of all the current legislators who do not have an account on C-SPAN's video website.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT official_full_name FROM current WHERE cspan_id IS NULL OR cspan_id = ''", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT official_full_name FROM current WHERE cspan_id IS NULL OR cspan_id = ''", "index": 2332, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['All', 'C', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlegislators who do not have an account refers to cspan_id IS NULL OR cspan_id = ''\nPlease list the official full names of all the current legislators who do not have an account on C-SPAN's video website.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1960-01-01', '1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1960-01-05', '1960-01-07', '1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1960-01-06', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn after the year 1960 refers to birthday_bio > '1960-01-01'\nHow many current legislators were born after the year 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(bioguide_id) FROM current WHERE birthday_bio >= '1961-01-01'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(bioguide_id) FROM current WHERE birthday_bio >= '1961-01-01'", "index": 2333, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1960-01-01', '1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1960-01-05', '1960-01-07', '1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1960-01-06', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn after the year 1960 refers to birthday_bio > '1960-01-01'\nHow many current legislators were born after the year 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n house_history_id real, -- example: [9479.0, 10177.0]\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n official_full_name text, -- example: ['Maria Cantwell', 'Sherrod Brown']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nolder refers to MAX(birthday_bio); 'Sherrod Brown' and 'Maria Cantwell' are official_full_name\nWhich current legislator is older, Sherrod Brown or Maria Cantwell?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1", "index": 2334, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n house_history_id real, -- example: [9479.0, 10177.0]\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n official_full_name text, -- example: ['Maria Cantwell', 'Sherrod Brown']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nolder refers to MAX(birthday_bio); 'Sherrod Brown' and 'Maria Cantwell' are official_full_name\nWhich current legislator is older, Sherrod Brown or Maria Cantwell?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Todd Young', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Young', 'Todd', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTodd Young is an official_full_name; username of current official Facebook presences refers to facebook;\nWhat is the username of the current official Facebook presence of current legislator Todd Young?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.facebook FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Todd Young'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.facebook FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Todd Young'", "index": 2335, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Todd Young', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Young', 'Todd', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTodd Young is an official_full_name; username of current official Facebook presences refers to facebook;\nWhat is the username of the current official Facebook presence of current legislator Todd Young?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['HI', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['HI', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Doe', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull official name refers to official_full_name\nTo which current legislator does twitter ID234128524 belong? Please give his or her full official name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.twitter_id = 234128524", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.twitter_id = 234128524", "index": 2336, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['HI', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['HI', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Doe', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull official name refers to official_full_name\nTo which current legislator does twitter ID234128524 belong? Please give his or her full official name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Max', 'Richard', 'Theodorick']\n house_history_id real, -- example: [9479.0, 10177.0]\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n relation text, -- example: ['son', 'nephew']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n suffix_name text, -- example: ['Jr.', 'III']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nusername of the official Facebook refers to facebook; the oldest refers to MAX(birthday_bio)\nWhat is the username of the current official Facebook presence of the oldest current legislator?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id ORDER BY T1.birthday_bio LIMIT 1", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id ORDER BY T1.birthday_bio LIMIT 1", "index": 2337, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Max', 'Richard', 'Theodorick']\n house_history_id real, -- example: [9479.0, 10177.0]\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n relation text, -- example: ['son', 'nephew']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n suffix_name text, -- example: ['Jr.', 'III']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nusername of the official Facebook refers to facebook; the oldest refers to MAX(birthday_bio)\nWhat is the username of the current official Facebook presence of the oldest current legislator?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Roger', 'F.', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Wicker', 'Brown', 'Cantwell']\n middle_name text, -- example: ['F.', 'L.', 'Richard']\n official_full_name text, -- example: ['Roger F. Wicker', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Roger', 'F.', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n house_history_alternate_id text, -- example: ['13283.0']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Roger', 'F.', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n state text, -- example: ['OH', 'WA']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRoger F. Wicker is an official_full_name; not a representative refers to district IS NULL OR district = ''\nCurrent legislator Roger F. Wicker has not been a representative for how many terms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name = 'Roger F. Wicker' THEN 1 ELSE 0 END) AS count FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.district IS NULL OR T2.district = ''", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.official_full_name = 'Roger F. Wicker' THEN 1 ELSE 0 END) AS count FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.district IS NULL OR T2.district = ''", "index": 2338, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Roger', 'F.', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Wicker', 'Brown', 'Cantwell']\n middle_name text, -- example: ['F.', 'L.', 'Richard']\n official_full_name text, -- example: ['Roger F. Wicker', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Roger', 'F.', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n house_history_alternate_id text, -- example: ['13283.0']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Roger', 'F.', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n state text, -- example: ['OH', 'WA']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRoger F. Wicker is an official_full_name; not a representative refers to district IS NULL OR district = ''\nCurrent legislator Roger F. Wicker has not been a representative for how many terms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Brown', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSherrod Brown is an official_full_name\nFor how many terms has current legislator Sherrod Brown served?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Sherrod Brown'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Sherrod Brown'", "index": 2339, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Brown', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSherrod Brown is an official_full_name\nFor how many terms has current legislator Sherrod Brown served?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1993-01-03', '1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['HI', 'OH', 'WA']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n `start` text, -- example: ['1993-01-05', '1789-03-04', '1790-01-01']\n state text, -- example: ['HI', 'DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSherrod Brown is an full official name; started on 1993/1/5 refers to start = '1993-01-05';\nFor which state did current legislator Sherrod Brown serve during his term that started on 1993/1/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.state FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.start = '1993-01-05' AND T2.official_full_name = 'Sherrod Brown'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.state FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.start = '1993-01-05' AND T2.official_full_name = 'Sherrod Brown'", "index": 2340, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1993-01-03', '1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['HI', 'OH', 'WA']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n `start` text, -- example: ['1993-01-05', '1789-03-04', '1790-01-01']\n state text, -- example: ['HI', 'DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSherrod Brown is an full official name; started on 1993/1/5 refers to start = '1993-01-05';\nFor which state did current legislator Sherrod Brown serve during his term that started on 1993/1/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 `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['More', 'All', 'Samuel', 'Henry']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party text, -- example: ['Democrat', 'Republican']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender_bio = 'F'; served for more than 4 terms refers to COUNT(bioguide > 4)\nAmong all the female current legislators, how many of them have served for more than 4 terms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 )", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 )", "index": 2341, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['More', 'All', 'Samuel', 'Henry']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party text, -- example: ['Democrat', 'Republican']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender_bio = 'F'; served for more than 4 terms refers to COUNT(bioguide > 4)\nAmong all the female current legislators, how many of them have served for more than 4 terms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1960-01-01', '1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1960-01-05', '1960-01-07', '1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Richard', 'Theodorick']\n govtrack_id integer, -- example: [401222, 401521]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['More', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1960-01-06', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n maplight_id real, -- example: [168.0, 544.0]\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nserved for more than 6 terms refers to COUNT(bioguide > 6); born after 1960 refers to birthday_bio > = '1960-01-01'\nAmong the current legislators who have served for more than 6 terms, how many of them were born after 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio >= '1960-01-01' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 6 )", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(CID) FROM ( SELECT T1.bioguide_id AS CID FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio >= '1960-01-01' GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 6 )", "index": 2342, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1960-01-01', '1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1960-01-05', '1960-01-07', '1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Richard', 'Theodorick']\n govtrack_id integer, -- example: [401222, 401521]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['More', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1960-01-06', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n maplight_id real, -- example: [168.0, 544.0]\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nserved for more than 6 terms refers to COUNT(bioguide > 6); born after 1960 refers to birthday_bio > = '1960-01-01'\nAmong the current legislators who have served for more than 6 terms, how many of them were born after 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state_rank text, -- example: ['junior', 'senior']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender_bio = 'M'\nHow many males were members of the current legislators?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 current WHERE gender_bio = 'M'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current WHERE gender_bio = 'M'", "index": 2343, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state_rank text, -- example: ['junior', 'senior']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender_bio = 'M'\nHow many males were members of the current legislators?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n relation text,\n state_rank text, -- example: ['junior', 'senior']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [400050, 300018]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender_bio = 'F'\nHow many females were members of the past legislators?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 historical WHERE gender_bio = 'F'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM historical WHERE gender_bio = 'F'", "index": 2344, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n relation text,\n state_rank text, -- example: ['junior', 'senior']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [400050, 300018]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender_bio = 'F'\nHow many females were members of the past legislators?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Sherrod', 'Richard', 'Theodorick']\n house_history_alternate_id text, -- example: ['13283.0']\n last_name text, -- example: ['Sherrod', 'Brown', 'Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npolitical party refers to party; Sherrod Brown is an official_full_name; official_full_name refers to first_name, last_name; 2005 refers to start = 2005\nWhat type of political party Sherrod Brown has in 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.party FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Sherrod' AND T2.last_name = 'Brown' AND T1.start LIKE '%2005%'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.party FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Sherrod' AND T2.last_name = 'Brown' AND T1.start LIKE '%2005%'", "index": 2345, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Sherrod', 'Richard', 'Theodorick']\n house_history_alternate_id text, -- example: ['13283.0']\n last_name text, -- example: ['Sherrod', 'Brown', 'Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npolitical party refers to party; Sherrod Brown is an official_full_name; official_full_name refers to first_name, last_name; 2005 refers to start = 2005\nWhat type of political party Sherrod Brown has in 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Warner', 'Mark', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Warner', 'Doe', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Warner', 'Mark', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Mark Warner', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Mark', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Warner', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Mark', 'Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Mark Warner', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nofficial social media refers to facebook is not null, instagram is not null, twitter is not null, youtube is not null; Mark Warner is an official_full_name; official_full_name refers to first_name, last_name\nHow many official social media does Mark Warner have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CASE WHEN T1.facebook IS NOT NULL THEN 1 END + CASE WHEN T1.instagram IS NOT NULL THEN 1 END + CASE WHEN T1.twitter IS NOT NULL THEN 1 END + CASE WHEN T1.youtube IS NOT NULL THEN 1 END AS COUNTSOCIAL FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.first_name = 'Mark' AND T2.last_name = 'Warner'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CASE WHEN T1.facebook IS NOT NULL THEN 1 END + CASE WHEN T1.instagram IS NOT NULL THEN 1 END + CASE WHEN T1.twitter IS NOT NULL THEN 1 END + CASE WHEN T1.youtube IS NOT NULL THEN 1 END AS COUNTSOCIAL FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.first_name = 'Mark' AND T2.last_name = 'Warner'", "index": 2346, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Warner', 'Mark', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Warner', 'Doe', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Warner', 'Mark', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Mark Warner', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Mark', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Warner', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Mark', 'Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Mark Warner', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nofficial social media refers to facebook is not null, instagram is not null, twitter is not null, youtube is not null; Mark Warner is an official_full_name; official_full_name refers to first_name, last_name\nHow many official social media does Mark Warner have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n maplight_id text, -- example: ['232.0', '581.0']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n thomas_id text, -- example: ['01308', '01270']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; female refers to gender_bio = 'F'; senators refers to type = 'sen'\nList the full name of all current female senators.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.type = 'sen' AND T2.gender_bio = 'F' GROUP BY T2.ballotpedia_id", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.first_name, T2.last_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.type = 'sen' AND T2.gender_bio = 'F' GROUP BY T2.ballotpedia_id", "index": 2347, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n maplight_id text, -- example: ['232.0', '581.0']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n thomas_id text, -- example: ['01308', '01270']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; female refers to gender_bio = 'F'; senators refers to type = 'sen'\nList the full name of all current female senators.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Chris', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n official_full_name text, -- example: ['Chris Van Hollen', 'Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n wikipedia_id text, -- example: ['Chris Van Hollen', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n nickname_name text, -- nickname, example: ['Chris', 'Van', 'of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChris Van Hollen is an official_full_name; numeric ID on GovTrack.us refers to govtrack\nWhat is the numeric ID of Chris Van Hollen on GovTrack.us?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.govtrack FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Chris Van Hollen'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.govtrack FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Chris Van Hollen'", "index": 2348, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Chris', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n official_full_name text, -- example: ['Chris Van Hollen', 'Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n wikipedia_id text, -- example: ['Chris Van Hollen', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n nickname_name text, -- nickname, example: ['Chris', 'Van', 'of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChris Van Hollen is an official_full_name; numeric ID on GovTrack.us refers to govtrack\nWhat is the numeric ID of Chris Van Hollen on GovTrack.us?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n name text,\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n last_name text, -- example: ['Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n house_history_id real, -- example: [9996.0, 10608.0]\n official_full_name text, -- example: ['Roger F. Wicker', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwitter handle refers to twitter; Roger F. Wicker is an official_full_name\nWhat is the current official Twitter handle of Roger F. Wicker?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.twitter FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Roger F. Wicker'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.twitter FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Roger F. Wicker'", "index": 2349, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n name text,\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n last_name text, -- example: ['Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n house_history_id real, -- example: [9996.0, 10608.0]\n official_full_name text, -- example: ['Roger F. Wicker', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwitter handle refers to twitter; Roger F. Wicker is an official_full_name\nWhat is the current official Twitter handle of Roger F. Wicker?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['All', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Pro-administration', 'Pro-Administration', 'Anti-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; chose Pro-Administration as their political party refers to party = 'Pro-Administration'; 1791 refers to start < = 1791 AND END > = 1791\nList the full name of all past legislators that chose Pro-Administration as their political party in year 1791.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T1.last_name FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Pro-Administration' AND CAST(T2.start AS DATE) <= 1791 AND CAST(T2.END AS DATE) >= 1791", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.first_name, T1.last_name FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Pro-Administration' AND CAST(T2.start AS DATE) <= 1791 AND CAST(T2.END AS DATE) >= 1791", "index": 2350, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['All', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Pro-administration', 'Pro-Administration', 'Anti-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; chose Pro-Administration as their political party refers to party = 'Pro-Administration'; 1791 refers to start < = 1791 AND END > = 1791\nList the full name of all past legislators that chose Pro-Administration as their political party in year 1791.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_id real, -- example: [9479.0, 10177.0]\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['All', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Republican', 'Democrat']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; official_full_name refers to first_name, last_name; female refers to gender_bio = 'F'; chose Republican as their political party refers to party = 'Republican'; current legislators refers to END > Date()\nProvide the full name of all current female legislators that chose Republican as their political party.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T1.last_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.gender_bio = 'F' AND T2.END > DATE() GROUP BY T1.bioguide_id", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.first_name, T1.last_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.gender_bio = 'F' AND T2.END > DATE() GROUP BY T1.bioguide_id", "index": 2351, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_id real, -- example: [9479.0, 10177.0]\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['All', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Republican', 'Democrat']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; official_full_name refers to first_name, last_name; female refers to gender_bio = 'F'; chose Republican as their political party refers to party = 'Republican'; current legislators refers to END > Date()\nProvide the full name of all current female legislators that chose Republican as their political party.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n youtube text, -- example: ['RepWassermanSchultz', 'RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n house_history_id real, -- example: [9996.0, 10608.0]\n middle_name text, -- example: ['L.', 'Richard']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n name text,\n state text, -- example: ['ID', 'DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n state text, -- example: ['ID', 'OH', 'WA']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepWassermanSchultz refers to youtube\nGive the YouTube ID of the channel 'RepWassermanSchultz.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT youtube_id FROM `social-media` WHERE youtube = 'RepWassermanSchultz'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT youtube_id FROM `social-media` WHERE youtube = 'RepWassermanSchultz'", "index": 2352, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n youtube text, -- example: ['RepWassermanSchultz', 'RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n house_history_id real, -- example: [9996.0, 10608.0]\n middle_name text, -- example: ['L.', 'Richard']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n name text,\n state text, -- example: ['ID', 'DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n state text, -- example: ['ID', 'OH', 'WA']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepWassermanSchultz refers to youtube\nGive the YouTube ID of the channel 'RepWassermanSchultz.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n name text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Adam', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Adam Kinzinger', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Adam Kinzinger', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFacebook, Twitter and YouTube usernames refers to facebook, twitter, youtube; Adam Kinzinger is an official_full_name\nWhat are the Facebook, Twitter and YouTube usernames of Adam Kinzinger?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Adam Kinzinger'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.official_full_name = 'Adam Kinzinger'", "index": 2353, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n name text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Adam', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Adam Kinzinger', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Adam Kinzinger', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFacebook, Twitter and YouTube usernames refers to facebook, twitter, youtube; Adam Kinzinger is an official_full_name\nWhat are the Facebook, Twitter and YouTube usernames of Adam Kinzinger?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Christopher', 'Sherrod', 'Maria']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Clark', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['Clark', 'L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Christopher', 'Henderson', 'Clark', 'Richard', 'Theodorick']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Christopher', 'Henderson', 'Clark', 'Doe', 'Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Christopher', 'Henderson', 'Clark', 'Samuel', 'Henry']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChristopher Henderson Clark is full name; full name refers to first_name, middle_name, last_name\nWhich party does Christopher Henderson Clark 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 T1.party FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name OR T2.middle_name OR T2.last_name = 'ChristopherHendersonClark'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.party FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name OR T2.middle_name OR T2.last_name = 'ChristopherHendersonClark'", "index": 2354, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Christopher', 'Sherrod', 'Maria']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Clark', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['Clark', 'L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Christopher', 'Henderson', 'Clark', 'Richard', 'Theodorick']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Christopher', 'Henderson', 'Clark', 'Doe', 'Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Christopher', 'Henderson', 'Clark', 'Samuel', 'Henry']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChristopher Henderson Clark is full name; full name refers to first_name, middle_name, last_name\nWhich party does Christopher Henderson Clark 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 historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave a YouTube account but no Instagram account refers to facebook is not null and (instagram is null or instagram = '')\nList the official full names of 10 legislators who have a YouTube account but no Instagram account.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.facebook IS NOT NULL AND (T1.instagram IS NULL OR T1.instagram = '') LIMIT 10", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.official_full_name FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.facebook IS NOT NULL AND (T1.instagram IS NULL OR T1.instagram = '') LIMIT 10", "index": 2355, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave a YouTube account but no Instagram account refers to facebook is not null and (instagram is null or instagram = '')\nList the official full names of 10 legislators who have a YouTube account but no Instagram account.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['VA', 'DE']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['VA', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Virginia', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nVirginia refers to state = 'VA'\nGive the official full names of legislators representing Virginia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'VA' GROUP BY T1.official_full_name", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'VA' GROUP BY T1.official_full_name", "index": 2356, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['VA', 'DE']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['VA', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Virginia', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nVirginia refers to state = 'VA'\nGive the official full names of legislators representing Virginia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['National Greenbacker', 'Anti-Administration', 'Pro-Administration']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n house_history_alternate_id text, -- example: ['13283.0']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmembers of the National Greenbacker party refers to party = 'National Greenbacker'; first and last names refers to first_name, last_name\nWhich historical legislators are members of the National Greenbacker party? Write their first and last names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'National Greenbacker'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'National Greenbacker'", "index": 2357, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['National Greenbacker', 'Anti-Administration', 'Pro-Administration']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n house_history_alternate_id text, -- example: ['13283.0']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmembers of the National Greenbacker party refers to party = 'National Greenbacker'; first and last names refers to first_name, last_name\nWhich historical legislators are members of the National Greenbacker party? Write their first and last names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names refers to official_full_name; only have a Facebook account refers to youtube is NULL or youtube = '', instagram is NULL or instagram = '', twitter is NULL or twitter = '', facebook is not NULL and facebook = ''\nList the full names of 10 legislators who only have a Facebook account.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE (T1.youtube IS NULL OR T1.youtube = '') AND (T1.instagram IS NULL OR T1.instagram = '') AND (T1.twitter IS NULL OR T1.twitter = '') AND T1.facebook IS NOT NULL AND T1.facebook != ''", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.official_full_name FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE (T1.youtube IS NULL OR T1.youtube = '') AND (T1.instagram IS NULL OR T1.instagram = '') AND (T1.twitter IS NULL OR T1.twitter = '') AND T1.facebook IS NOT NULL AND T1.facebook != ''", "index": 2358, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names refers to official_full_name; only have a Facebook account refers to youtube is NULL or youtube = '', instagram is NULL or instagram = '', twitter is NULL or twitter = '', facebook is not NULL and facebook = ''\nList the full names of 10 legislators who only have a Facebook account.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Republican', 'Democrat']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Junior', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; junior refers to state_rank = 'junior'; Republicans refers to party = 'Republican'\nWrite the full names of junior ranked Republicans.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T2.state_rank = 'junior' GROUP BY T1.official_full_name", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T2.state_rank = 'junior' GROUP BY T1.official_full_name", "index": 2359, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Republican', 'Democrat']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Junior', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; junior refers to state_rank = 'junior'; Republicans refers to party = 'Republican'\nWrite the full names of junior ranked Republicans.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n name text,\n relation text,\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Bassett', 'Bland']\n middle_name text, -- example: ['Claire', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Claire McCaskill', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n official_full_name text, -- example: ['Claire McCaskill', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncontact URL refers to contact_form; Claire McCaskill is an official_full_name\nWhat is the contact URL of Claire McCaskill?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.contact_form FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Claire McCaskill' GROUP BY T2.contact_form", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.contact_form FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Claire McCaskill' GROUP BY T2.contact_form", "index": 2360, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n name text,\n relation text,\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Bassett', 'Bland']\n middle_name text, -- example: ['Claire', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Claire McCaskill', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n official_full_name text, -- example: ['Claire McCaskill', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncontact URL refers to contact_form; Claire McCaskill is an official_full_name\nWhat is the contact URL of Claire McCaskill?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Readjuster Democrat', 'Readjuster', 'Democrat', 'Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nReadjuster Democrats refers to party = 'Readjuster Democrat'\nGive the Wikipedia IDs of historical legislators who are Readjuster Democrats.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.wikipedia_id FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Readjuster Democrat'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.wikipedia_id FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Readjuster Democrat'", "index": 2361, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Readjuster Democrat', 'Readjuster', 'Democrat', 'Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nReadjuster Democrats refers to party = 'Readjuster Democrat'\nGive the Wikipedia IDs of historical legislators who are Readjuster Democrats.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Republican', 'Democrat']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names refers to official_full_name; Republican refers to party = 'Republican'; nickname refers to nickname_name\nList the full names of Republican legislators who have a nickname.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.nickname_name IS NOT NULL GROUP BY T1.official_full_name", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Republican' AND T1.nickname_name IS NOT NULL GROUP BY T1.official_full_name", "index": 2362, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Republican', 'Democrat']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names refers to official_full_name; Republican refers to party = 'Republican'; nickname refers to nickname_name\nList the full names of Republican legislators who have a nickname.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Veronica', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Boland', 'Bassett', 'Bland']\n middle_name text, -- example: ['Grace', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Grace', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nVeronica Grace Boland is a full name; full name refers to first_name, middle_name, last_name; party affiliated refers to party\nWhich state did Veronica Grace Boland represent and which party is she affiliated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.state, T2.party FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name OR T1.middle_name OR T1.last_name = 'VeronicaGraceBoland'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.state, T2.party FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name OR T1.middle_name OR T1.last_name = 'VeronicaGraceBoland'", "index": 2363, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Veronica', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Boland', 'Bassett', 'Bland']\n middle_name text, -- example: ['Grace', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Grace', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nVeronica Grace Boland is a full name; full name refers to first_name, middle_name, last_name; party affiliated refers to party\nWhich state did Veronica Grace Boland represent and which party is she affiliated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n house_history_id real, -- example: [9479.0, 10177.0]\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1973 refers to birthday_bio = 1973\nHow many historical legislators were born in 1973?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 historical WHERE CAST(birthday_bio AS date) = 1973", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM historical WHERE CAST(birthday_bio AS date) = 1973", "index": 2364, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n house_history_id real, -- example: [9479.0, 10177.0]\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1973 refers to birthday_bio = 1973\nHow many historical legislators were born in 1973?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Republican', 'Democrat']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n gender_bio text, -- example: ['M', 'F']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe legislators who will end in 2009 refers to END 2009; from the Republican party refers to party = 'Republican'\nAmong the legislators who will end in 2009, how many are from the Republican party?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT `END`, party FROM `current-terms` WHERE STRFTIME('%Y', `END`) = '2009' AND party = 'Republican'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT `END`, party FROM `current-terms` WHERE STRFTIME('%Y', `END`) = '2009' AND party = 'Republican'", "index": 2365, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n party text, -- example: ['Republican', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Republican', 'Democrat']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n gender_bio text, -- example: ['M', 'F']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe legislators who will end in 2009 refers to END 2009; from the Republican party refers to party = 'Republican'\nAmong the legislators who will end in 2009, how many are from the Republican party?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Independent', 'Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Independent', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndependent party refers to party = 'Independent'\nProvide the current legislators' official full names who are from the Independent party.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Independent' GROUP BY T1.official_full_name", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.party = 'Independent' GROUP BY T1.official_full_name", "index": 2366, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Independent', 'Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Independent', 'Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndependent party refers to party = 'Independent'\nProvide the current legislators' official full names who are from the Independent party.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['James', 'F.', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['James', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['James', 'F.', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Sensenbrenner', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['James', 'F.', 'L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJr. F. James Sensenbrenner is an official_full_name; How old refers to SUBTRACT(MIN(start), birthday_bio)\nHow old was Jr. F. James Sensenbrenner when he first started as a legislator?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(MIN(T2.start) - T1.birthday_bio AS DATE) AS AGE FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'F. James Sensenbrenner, Jr.'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(MIN(T2.start) - T1.birthday_bio AS DATE) AS AGE FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'F. James Sensenbrenner, Jr.'", "index": 2367, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['James', 'F.', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['James', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['James', 'F.', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Sensenbrenner', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['James', 'F.', 'L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJr. F. James Sensenbrenner is an official_full_name; How old refers to SUBTRACT(MIN(start), birthday_bio)\nHow old was Jr. F. James Sensenbrenner when he first started as a legislator?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Thomas', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Thomas', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave an Instagram account refers to instagram is not null; full names refers to official_full_name; nicknames refers to nickname_name; Thomas ID of less than 1000 refers to thomas_id < 1000;\nAmong legislators who have an Instagram account, list down their full names and nicknames who have a Thomas ID of less than 1000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.official_full_name, T1.nickname_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.instagram IS NOT NULL AND T1.thomas_id < 1000", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name, T1.nickname_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.instagram IS NOT NULL AND T1.thomas_id < 1000", "index": 2368, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Thomas', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Thomas', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave an Instagram account refers to instagram is not null; full names refers to official_full_name; nicknames refers to nickname_name; Thomas ID of less than 1000 refers to thomas_id < 1000;\nAmong legislators who have an Instagram account, list down their full names and nicknames who have a Thomas ID of less than 1000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Matt Salmon', 'Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Salmon', 'Matt', 'Richard', 'Theodorick']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Matt Salmon', 'Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n wikipedia_id text, -- example: ['Matt Salmon', 'Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMatt Salmon is an official_full_name\nWhen was the last serving date of Matt Salmon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.END FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Matt Salmon'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.END FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Matt Salmon'", "index": 2369, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Matt Salmon', 'Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Salmon', 'Matt', 'Richard', 'Theodorick']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Matt Salmon', 'Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n wikipedia_id text, -- example: ['Matt Salmon', 'Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMatt Salmon is an official_full_name\nWhen was the last serving date of Matt Salmon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n middle text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['House', 'Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave served in the U.S. House refers to house_history_id IS NOT NULL; born in 1738 refers to birthday_bio = 1738\nAmong the legislators who have served in the U.S. House, provide the party and the state of the legislators who were born in 1738.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.party, T1.state FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.house_history_id IS NOT NULL AND T2.birthday_bio LIKE '%1738%'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.party, T1.state FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.house_history_id IS NOT NULL AND T2.birthday_bio LIKE '%1738%'", "index": 2370, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n middle text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['House', 'Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave served in the U.S. House refers to house_history_id IS NOT NULL; born in 1738 refers to birthday_bio = 1738\nAmong the legislators who have served in the U.S. House, provide the party and the state of the legislators who were born in 1738.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n house_history_alternate_id text, -- example: ['13283.0']\n last_name text, -- example: ['Bassett', 'Bland']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Liberal Republican', 'Republican', 'Liberal', 'Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Republican', 'Democrat']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull_name refers to first_name, last_name; from the Liberal Republican party refers to party = 'Liberal Republican'\nList the IDs and full names of legislators from the Liberal Republican party.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bioguide_id, T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Liberal Republican'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.bioguide_id, T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Liberal Republican'", "index": 2371, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n house_history_alternate_id text, -- example: ['13283.0']\n last_name text, -- example: ['Bassett', 'Bland']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Liberal Republican', 'Republican', 'Liberal', 'Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Republican', 'Democrat']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull_name refers to first_name, last_name; from the Liberal Republican party refers to party = 'Liberal Republican'\nList the IDs and full names of legislators from the Liberal Republican party.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n maplight_id text, -- example: ['232.0', '581.0']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarted the term in 1875 refers to start LIKE '1875%'; started the term in 2005 refers to start LIKE '2005%'\nCompare the number of legislators who started the term in 1875 and 2005.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 `current-terms`.start LIKE '2005%' THEN 1 ELSE 0 END) - ( SELECT SUM(CASE WHEN start LIKE '1875%' THEN 1 ELSE 0 END) FROM `historical-terms` ) FROM `current-terms`", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT SUM(CASE WHEN `current-terms`.start LIKE '2005%' THEN 1 ELSE 0 END) - ( SELECT SUM(CASE WHEN start LIKE '1875%' THEN 1 ELSE 0 END) FROM `historical-terms` ) FROM `current-terms`", "index": 2372, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n maplight_id text, -- example: ['232.0', '581.0']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstarted the term in 1875 refers to start LIKE '1875%'; started the term in 2005 refers to start LIKE '2005%'\nCompare the number of legislators who started the term in 1875 and 2005.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Amy Klobuchar', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Amy', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Klobuchar', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Amy Klobuchar', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Amy Klobuchar', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbirthday refers to birthday_bio; Amy Klobuchar refers to full name; full name refers to first_name, last_name\nWhat is the birthday of Amy Klobuchar?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT birthday_bio FROM current WHERE first_name = 'Amy' AND last_name = 'Klobuchar'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT birthday_bio FROM current WHERE first_name = 'Amy' AND last_name = 'Klobuchar'", "index": 2373, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Amy Klobuchar', 'Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Amy', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Klobuchar', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Amy Klobuchar', 'Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Amy Klobuchar', 'Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbirthday refers to birthday_bio; Amy Klobuchar refers to full name; full name refers to first_name, last_name\nWhat is the birthday of Amy Klobuchar?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1942-02-20', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n house_history_id real, -- example: [9996.0, 10608.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1942-02-23', '1942-02-24', '1745-04-02', '1742-03-21']\n gender_bio text, -- example: ['M', 'F']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbirthday on 2/20/1942 refers to birthday_bio = '1942-02-20'\nWhat is the title of legislator whose birthday on 2/20/1942?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.title FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = '1942-02-20' GROUP BY T2.title", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.title FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = '1942-02-20' GROUP BY T2.title", "index": 2374, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1942-02-20', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n house_history_id real, -- example: [9996.0, 10608.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1942-02-23', '1942-02-24', '1745-04-02', '1742-03-21']\n gender_bio text, -- example: ['M', 'F']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbirthday on 2/20/1942 refers to birthday_bio = '1942-02-20'\nWhat is the title of legislator whose birthday on 2/20/1942?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Russell', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Washington', 'Russell', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Washington', 'Russell', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Washington', 'Russell', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['317 Russell Senate Office Building', '437 Russell Senate Office Building', '205 Russell Senate Office Building', '290 Russell Senate Office Building', '131 Russell Senate Office Building', '338 Russell Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['DC', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DC', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngender refers to gender_bio\nWhat is the gender of the legislator whose address at 317 Russell Senate Office Building Washington DC 20510?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.address = '317 Russell Senate Office Building Washington DC 20510'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.address = '317 Russell Senate Office Building Washington DC 20510'", "index": 2375, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Russell', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Washington', 'Russell', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Washington', 'Russell', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Washington', 'Russell', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['317 Russell Senate Office Building', '437 Russell Senate Office Building', '205 Russell Senate Office Building', '290 Russell Senate Office Building', '131 Russell Senate Office Building', '338 Russell Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['DC', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DC', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngender refers to gender_bio\nWhat is the gender of the legislator whose address at 317 Russell Senate Office Building Washington DC 20510?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n thomas_id text, -- example: ['01308', '01270']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender_bio = M; not the senator refers to class IS NULL OR class = ''\nAmong male legislators, state number of the legislators who are not the senator.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T3.state) FROM ( SELECT T2.state FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND (T2.class IS NULL OR T2.class = '') GROUP BY T2.state ) T3", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(T3.state) FROM ( SELECT T2.state FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'M' AND (T2.class IS NULL OR T2.class = '') GROUP BY T2.state ) T3", "index": 2376, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n thomas_id text, -- example: ['01308', '01270']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender_bio = M; not the senator refers to class IS NULL OR class = ''\nAmong male legislators, state number of the legislators who are not the senator.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n state text, -- example: ['DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot Senator refers to class is NULL; born before 1975 refers to birthday_bio < = 1975; calculation = MULTIPLY(DIVIDE(COUNT(class IS NULL THEN bioguide_id), COUNT(bioguide_id)), 1.0)\nCalculate the percentage of legislators who are not Senator and were born before 1975.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.class IS NULL THEN T1.bioguide_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE CAST(T1.birthday_bio AS DATE) <= 1975", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.class IS NULL THEN T1.bioguide_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE CAST(T1.birthday_bio AS DATE) <= 1975", "index": 2377, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n state text, -- example: ['DE', 'VA']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n thomas integer, -- example: [2222, 2019]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot Senator refers to class is NULL; born before 1975 refers to birthday_bio < = 1975; calculation = MULTIPLY(DIVIDE(COUNT(class IS NULL THEN bioguide_id), COUNT(bioguide_id)), 1.0)\nCalculate the percentage of legislators who are not Senator and were born before 1975.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['BLuetkemeyer', 'RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBluetkemeyer refers to youtube\nState the opensecrets_id of the legislator whose YouTube name is Bluetkemeyer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.opensecrets_id FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.youtube = 'BLuetkemeyer'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.opensecrets_id FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.youtube = 'BLuetkemeyer'", "index": 2378, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['BLuetkemeyer', 'RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBluetkemeyer refers to youtube\nState the opensecrets_id of the legislator whose YouTube name is Bluetkemeyer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Washington', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Washington', 'Longworth', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Washington', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the first name of the legislator whose address at 1005 Longworth HOB; Washington DC 20515-1408?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.address = '1005 Longworth HOB Washington DC 20515-1408' GROUP BY T1.first_name", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.first_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.address = '1005 Longworth HOB Washington DC 20515-1408' GROUP BY T1.first_name", "index": 2379, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n first_name text, -- example: ['Washington', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Washington', 'Longworth', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Washington', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the first name of the legislator whose address at 1005 Longworth HOB; Washington DC 20515-1408?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-08-24', '1952-08-25', '1952-08-28', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInstagram name refers to instagram; birthday on 8/24/1952 refers to birthday_bio = '1952-08-24'\nWhat is the Instagram name of the legislator whose birthday was on 8/24/1952?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.instagram FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.birthday_bio = '1952-08-24'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.instagram FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.birthday_bio = '1952-08-24'", "index": 2380, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-08-24', '1952-08-25', '1952-08-28', '1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInstagram name refers to instagram; birthday on 8/24/1952 refers to birthday_bio = '1952-08-24'\nWhat is the Instagram name of the legislator whose birthday was on 8/24/1952?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot the senator refers to class IS NULL OR class = ''; female refers to gender_bio = 'F';\nState number of legislators who are not the senator among female legislators.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND (T2.class IS NULL OR T2.class = '')", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND (T2.class IS NULL OR T2.class = '')", "index": 2381, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot the senator refers to class IS NULL OR class = ''; female refers to gender_bio = 'F';\nState number of legislators who are not the senator among female legislators.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n last_name text, -- example: ['Bassett', 'Bland']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n name text,\n phone text, -- example: ['202-224-4024', '202-224-4543']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n youtube text, -- example: ['MaxineWaters', 'RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMaxineWaters relates to youtube\nGive the religion of the legislator whose YouTube name is MaxineWaters.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.religion_bio FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.youtube = 'MaxineWaters'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.religion_bio FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.youtube = 'MaxineWaters'", "index": 2382, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n last_name text, -- example: ['Bassett', 'Bland']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n name text,\n phone text, -- example: ['202-224-4024', '202-224-4543']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n youtube text, -- example: ['MaxineWaters', 'RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMaxineWaters relates to youtube\nGive the religion of the legislator whose YouTube name is MaxineWaters.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n govtrack_id integer, -- example: [400050, 300018]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Leader', 'Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nminority leaders is a title; have not been registered in Federal Election Commission data refers to fec_id IS NULL OR fec_id = ''\nHow many minority leaders have not been registered in Federal Election Commission data?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.title = 'Minority Leader' AND (T1.fec_id IS NULL OR T1.fec_id = '')", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.title = 'Minority Leader' AND (T1.fec_id IS NULL OR T1.fec_id = '')", "index": 2383, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n govtrack_id integer, -- example: [400050, 300018]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Leader', 'Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nminority leaders is a title; have not been registered in Federal Election Commission data refers to fec_id IS NULL OR fec_id = ''\nHow many minority leaders have not been registered in Federal Election Commission data?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['RepWilson', 'congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepWilson', 'RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['ID', 'OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the facebook ID of the facebook account named \"RepWilson\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT facebook_id FROM `social-media` WHERE facebook = 'RepWilson'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT facebook_id FROM `social-media` WHERE facebook = 'RepWilson'", "index": 2384, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['RepWilson', 'congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepWilson', 'RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['ID', 'OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the facebook ID of the facebook account named \"RepWilson\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['John', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['John', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['John', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['John', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the total number of legislators with \"John\" as their first name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM current WHERE first_name = 'John'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current WHERE first_name = 'John'", "index": 2385, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['John', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['John', 'Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['John', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['John', 'Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the total number of legislators with \"John\" as their first name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; born in 1960 refers to birthday_bio like '1960%';\nList the full name of legislators whose born in 1960.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT official_full_name FROM current WHERE birthday_bio LIKE '1960%'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT official_full_name FROM current WHERE birthday_bio LIKE '1960%'", "index": 2386, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; born in 1960 refers to birthday_bio like '1960%';\nList the full name of legislators whose born in 1960.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n state text, -- example: ['ID', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Benjamin', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Benjamin', 'Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n last_name text, -- example: ['Benjamin', 'Hawkins', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Benjamin', 'Hawkins', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the google entity ID of Benjamin Hawkins?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT google_entity_id_id FROM historical WHERE first_name = 'Benjamin' AND last_name = 'Hawkins'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT google_entity_id_id FROM historical WHERE first_name = 'Benjamin' AND last_name = 'Hawkins'", "index": 2387, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n state text, -- example: ['ID', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Benjamin', 'Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Benjamin', 'Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n last_name text, -- example: ['Benjamin', 'Hawkins', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Benjamin', 'Hawkins', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the google entity ID of Benjamin Hawkins?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['House', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n govtrack_id integer, -- example: [400050, 300018]\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepresentatives refers to type = 'rep';\nWhat are the first and last name of the representatives of the house in district 9?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.district = 9", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.district = 9", "index": 2388, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['House', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Samuel', 'Henry']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n govtrack_id integer, -- example: [400050, 300018]\n last_name text, -- example: ['Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepresentatives refers to type = 'rep';\nWhat are the first and last name of the representatives of the house in district 9?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n relation text,\n state text, -- example: ['NY', 'ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n relation text, -- example: ['son', 'nephew']\n state text, -- example: ['NY', 'ID', 'OH', 'WA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoogle entity ID refers to google_entity_id_id; senators refers to type = 'sen'; New York refers to state = 'NY';\nProvide the google entity ID of the senators in New York.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.google_entity_id_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.state = 'NY'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.google_entity_id_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.state = 'NY'", "index": 2389, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n relation text,\n state text, -- example: ['NY', 'ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n relation text, -- example: ['son', 'nephew']\n state text, -- example: ['NY', 'ID', 'OH', 'WA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoogle entity ID refers to google_entity_id_id; senators refers to type = 'sen'; New York refers to state = 'NY';\nProvide the google entity ID of the senators in New York.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.corker.senate.gov', 'http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreligion refers to religion_bio;\nGive the religion of the legislator with RSS url of http://www.corker.senate.gov/public/index.cfm/rss/feed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.religion_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.rss_url = 'http://www.corker.senate.gov/public/index.cfm/rss/feed' GROUP BY T1.religion_bio", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.religion_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.rss_url = 'http://www.corker.senate.gov/public/index.cfm/rss/feed' GROUP BY T1.religion_bio", "index": 2390, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.corker.senate.gov', 'http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreligion refers to religion_bio;\nGive the religion of the legislator with RSS url of http://www.corker.senate.gov/public/index.cfm/rss/feed.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n house_history_id real, -- example: [9996.0, 10608.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['M.', 'L.', 'Richard']\n official_full_name text, -- example: ['Susan M. Collins', 'Sherrod Brown', 'Maria Cantwell']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Collins', 'Collin', 'M.', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlegislator's name refers to offical_full_name;\nWhat is the party of the legislator named Susan M. Collins?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Susan M. Collins' GROUP BY T2.party", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Susan M. Collins' GROUP BY T2.party", "index": 2391, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n house_history_id real, -- example: [9996.0, 10608.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['M.', 'L.', 'Richard']\n official_full_name text, -- example: ['Susan M. Collins', 'Sherrod Brown', 'Maria Cantwell']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n cspan_id text, -- example: ['12590.0', '4479.0']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['Collins', 'Collin', 'M.', 'Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n district real, -- example: [9.0, 2.0]\n last text, -- example: ['Levy', 'Lambert']\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n title text, -- example: ['Majority Leader', 'Speaker']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlegislator's name refers to offical_full_name;\nWhat is the party of the legislator named Susan M. Collins?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; birth date refers to birthday_bio;\nProvide the full name and birth date of the legislator with a contact form of http://www.brown.senate.gov/contact/.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.official_full_name, T1.birthday_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.contact_form = 'http://www.brown.senate.gov/contact/'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name, T1.birthday_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.contact_form = 'http://www.brown.senate.gov/contact/'", "index": 2392, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n middle_name text, -- example: ['L.', 'Richard']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to official_full_name; birth date refers to birthday_bio;\nProvide the full name and birth date of the legislator with a contact form of http://www.brown.senate.gov/contact/.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pyzk', 'kg:/m/02pz46', 'kg:/m/033mf4']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of term refers to type; google entity ID refers to google_entity_id_id; google_entity_id_id = 'kg:/m/02pyzk';\nGive the state and type of term of the legislator with the google entity ID of kg:/m/02pyzk.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.state, T2.type FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.google_entity_id_id = 'kg:/m/02pyzk'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.state, T2.type FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.google_entity_id_id = 'kg:/m/02pyzk'", "index": 2393, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n class real, -- example: [1.0, 2.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pyzk', 'kg:/m/02pz46', 'kg:/m/033mf4']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n middle_name text, -- example: ['Samuel', 'Henry']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of term refers to type; google entity ID refers to google_entity_id_id; google_entity_id_id = 'kg:/m/02pyzk';\nGive the state and type of term of the legislator with the google entity ID of kg:/m/02pyzk.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference = SUBTRACT(SUM(type = 'sen' WHERE gender_bio = 'F' AND strftime('%Y', birthday_bio) between '1930' and '1970'), SUM(type = 'rep' WHERE gender_bio = 'F' AND strftime('%Y', birthday_bio) between '1930' and '1970')); female refers to gender_bio = 'F'; senators refers to type = 'sen'; representatives refers to type = 'rep'; born between 1930 to 1970 strftime('%Y', birthday_bio) between '1930' and '1970';\nFind the difference between the number of female senators and representatives born between 1930 to 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.type = 'rep' THEN 1 ELSE 0 END) FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND strftime('%Y', T1.birthday_bio) BETWEEN '1930' AND '1970'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.type = 'rep' THEN 1 ELSE 0 END) FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND strftime('%Y', T1.birthday_bio) BETWEEN '1930' AND '1970'", "index": 2394, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n house_history_id real, -- example: [9996.0, 10608.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Samuel', 'Henry']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference = SUBTRACT(SUM(type = 'sen' WHERE gender_bio = 'F' AND strftime('%Y', birthday_bio) between '1930' and '1970'), SUM(type = 'rep' WHERE gender_bio = 'F' AND strftime('%Y', birthday_bio) between '1930' and '1970')); female refers to gender_bio = 'F'; senators refers to type = 'sen'; representatives refers to type = 'rep'; born between 1930 to 1970 strftime('%Y', birthday_bio) between '1930' and '1970';\nFind the difference between the number of female senators and representatives born between 1930 to 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['W000059', 'A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['W000059', 'A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the legislator = first_name, last_name; ID of W000059 refers to bioguide_id = 'W000059';\nWhat is the name of the legislator with the ID of W000059?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT first_name, last_name FROM historical WHERE bioguide_id = 'W000059'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT first_name, last_name FROM historical WHERE bioguide_id = 'W000059'", "index": 2395, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n bioguide_id text, -- example: ['W000059', 'A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['W000059', 'A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n state text, -- example: ['ID', 'DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n url text, -- example: ['http://edwards.senate.gov/', 'http://fitzgerald.senate.gov/']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the legislator = first_name, last_name; ID of W000059 refers to bioguide_id = 'W000059';\nWhat is the name of the legislator with the ID of W000059?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [401222, 401521]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party text, -- example: ['Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1736 refers to birthday_bio like '1736%';\nHow many legislators were born in 1736?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(bioguide_id) FROM historical WHERE birthday_bio LIKE '1736%'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(bioguide_id) FROM historical WHERE birthday_bio LIKE '1736%'", "index": 2396, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['M', 'F']\n govtrack_id integer, -- example: [401222, 401521]\n lis_id text, -- legislator id, example: ['S134', 'S135']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n party text, -- example: ['Democrat', 'Republican']\n relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n relation text,\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1736 refers to birthday_bio like '1736%';\nHow many legislators were born in 1736?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwoman refers to gender_bio = 'F';\nWhich legislators are woman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT first_name, last_name FROM historical WHERE gender_bio = 'F'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT first_name, last_name FROM historical WHERE gender_bio = 'F'", "index": 2397, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n relation text,\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n govtrack real, -- example: [412664.0, 412428.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n state text, -- example: ['OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\n type text, -- example: ['rep', 'sen']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwoman refers to gender_bio = 'F';\nWhich legislators are woman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdaho refers to state = 'ID';\nHow many districts are in Idaho?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(district) FROM `current-terms` WHERE state = 'ID'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(district) FROM `current-terms` WHERE state = 'ID'", "index": 2398, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n district real, -- example: [9.0, 2.0]\n middle text,\n name text,\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n phone text, -- example: ['202-224-4024', '202-224-4543']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', 'DE', 'VA']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['ID', 'OH', 'WA']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n house_history_id real, -- example: [9996.0, 10608.0]\n last_name text, -- example: ['Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIdaho refers to state = 'ID';\nHow many districts are in Idaho?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot senator refers to class is null;\nHow many legislators are not senator?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(bioguide) FROM `current-terms` WHERE class IS NULL", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(bioguide) FROM `current-terms` WHERE class IS NULL", "index": 2399, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current-terms` (\n address text, -- example: ['713 HART SENATE OFFICE BUILDING WASHINGT', '713 Hart Senate Office Building Washingt']\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n caucus text, -- example: ['Democrat']\n chamber text, -- example: ['senate', 'house']\n class real, -- example: [1.0, 2.0]\n contact_form text, -- example: ['http://www.brown.senate.gov/contact/', 'http://www.brown.senate.gov/contact']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n fax text, -- example: ['202-228-6321', '202-228-0514']\n last text, -- example: ['Menendez']\n name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\n party text, -- example: ['Democrat', 'Republican']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-02-\", \"{'start': '1993-01-05', 'end': '1994-11-\"]\n phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\n rss_url text, -- Really Simple Syndication URL, example: ['http://www.brown.senate.gov/rss/feeds/?t', 'http://www.cantwell.senate.gov/public/in']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\n state_rank text, -- example: ['senior', 'junior']\n title text, -- example: ['Minority Whip', 'Majority Whip']\n type text, -- example: ['rep', 'sen']\n url text, -- example: ['http://www.house.gov/sherrodbrown', 'http://brown.senate.gov/']\n PRIMARY KEY (bioguide, `end`),\n CONSTRAINT fk_current-terms_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE `current` (\n ballotpedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n bioguide_id text, -- example: ['A000055', 'A000360']\n birthday_bio date, -- example: ['1952-11-09', '1958-10-13']\n cspan_id real, -- example: [45516.0, 5.0]\n fec_id text, -- example: [\"['H2OH13033', 'S6OH00163']\", \"['S8WA00194', 'H2WA01054']\"]\n first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/034s80', 'kg:/m/01x68t']\n govtrack_id integer, -- example: [400050, 300018]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [29389.0, 39310.0]\n lis_id text, -- legislator id, example: ['S307', 'S275']\n maplight_id real, -- example: [168.0, 544.0]\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\n religion_bio text, -- example: ['Lutheran', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'III']\n thomas_id integer, -- example: [136, 172]\n votesmart_id real, -- example: [27018.0, 27122.0]\n wikidata_id text, -- example: ['Q381880', 'Q22250']\n wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_id)\n);\n\nCREATE TABLE `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\n facebook text, -- example: ['congresswomanaumuaamata', 'RepToddYoung']\n facebook_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram text, -- example: ['senjoniernst', 'senatorwarner']\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', 'RepToddYoung']\n twitter_id real, -- example: [3026622545.0, 234128524.0]\n youtube text, -- example: ['RepToddYoung', 'RepYoder']\n youtube_id text, -- example: ['UCGdrLQbt1PYDTPsampx4t1A', 'UCuknj4PGn91gHDNAfboZEgQ']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_social-media_bioguide FOREIGN KEY (bioguide) REFERENCES `current` (bioguide_id)\n);\n\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\n cspan_id text, -- example: ['12590.0', '4479.0']\n fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Richard', 'Theodorick']\n google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\n govtrack_id integer, -- example: [401222, 401521]\n house_history_alternate_id text, -- example: ['13283.0']\n house_history_id real, -- example: [9479.0, 10177.0]\n icpsr_id real, -- interuniversity consortium for political and social research id, example: [507.0, 786.0]\n last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n thomas_id text, -- example: ['01308', '01270']\n votesmart_id text, -- example: ['52156.0', '128775.0']\n wikidata_id text, -- example: ['Q518823', 'Q1749152']\n wikipedia_id text, -- example: ['Richard Bassett (politician)', 'Theodorick Bland (congressman)']\n PRIMARY KEY (bioguide_id)\n);\n\nCREATE TABLE `historical-terms` (\n address text, -- example: ['248 RUSSELL SENATE OFFICE BUILDING WASHI', '359 DIRKSEN SENATE OFFICE BUILDING WASHI']\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\n class real, -- example: [2.0, 1.0]\n contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\n `end` text, -- example: ['1793-03-03', '1791-03-03']\n fax text, -- example: ['202-228-6363', '202-226-6299']\n last text, -- example: ['Levy', 'Lambert']\n middle text,\n name text,\n office text, -- example: ['248 Russell Senate Office Building', '359 Dirksen Senate Office Building']\n party text, -- example: ['Anti-Administration', 'Pro-Administration']\n party_affiliations text, -- example: [\"{'start': '2009-01-06', 'end': '2009-12-\", \"{'start': '2003-01-07', 'end': '2004-08-\"]\n phone text, -- example: ['202-224-4024', '202-224-4543']\n rss_url text, -- Really Simple Syndication URL, example: ['http://radel.house.gov/news/rss.aspx', 'http://www.begich.senate.gov/public/?a=r']\n state text, -- example: ['DE', 'VA']\n state_rank text, -- example: ['junior', 'senior']\n title text, -- example: ['Majority Leader', 'Speaker']\n type text, -- example: ['sen', 'rep']\n PRIMARY KEY (bioguide),\n CONSTRAINT fk_historical-terms_bioguide FOREIGN KEY (bioguide) REFERENCES historical (bioguide_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot senator refers to class is null;\nHow many legislators are not senator?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }