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 `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-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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = DIVIDE(SUM(gender_bio = 'M'),  SUM(gender_bio = 'F')); male refers to gender_bio = 'M'; female refers to gender_bio = 'F'\nWhat is the ratio between male and 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 CAST(SUM(CASE WHEN gender_bio = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) FROM historical", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN gender_bio = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) FROM historical", "index": 2400, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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-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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = DIVIDE(SUM(gender_bio = 'M'),  SUM(gender_bio = 'F')); male refers to gender_bio = 'M'; female refers to gender_bio = 'F'\nWhat is the ratio between male and 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 `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 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 suffix_name text, -- example: ['Jr.', 'III']\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 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 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_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 religion_bio text, -- example: ['Baptist', 'Roman Catholic']\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_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 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 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 `start` text, -- example: ['1993-01-05', '1995-01-04']\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-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 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 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 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:\npercentage = MULTIPLY(DIVIDE(SUM(wikipedia_id is not null), (bioguide_id)), 100.0); famous legislators refers to wikipedia_id is not null;\nCalculate the percentage of famous_legislatorss.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN wikipedia_id IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(bioguide_id) FROM historical", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN wikipedia_id IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(bioguide_id) FROM historical", "index": 2401, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['M', 'F']\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 suffix_name text, -- example: ['Jr.', 'III']\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 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 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_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 religion_bio text, -- example: ['Baptist', 'Roman Catholic']\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_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 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 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 `start` text, -- example: ['1993-01-05', '1995-01-04']\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-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 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 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 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:\npercentage = MULTIPLY(DIVIDE(SUM(wikipedia_id is not null), (bioguide_id)), 100.0); famous legislators refers to wikipedia_id is not null;\nCalculate the percentage of famous_legislatorss.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Benjamin', 'Sherrod', 'Maria']\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 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_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 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);\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 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 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 fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Benjamin', '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: ['Benjamin', 'Contee', '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', 'Contee', 'All', 'Samuel', 'Henry']\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: ['Benjamin Contee', '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 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 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:\nState all the district that Benjamin Contee has served before.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.district FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T1.last_name = 'Contee'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.district FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T1.last_name = 'Contee'", "index": 2402, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Benjamin', 'Sherrod', 'Maria']\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 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_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 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);\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 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 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 fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\n first_name text, -- example: ['Benjamin', '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: ['Benjamin', 'Contee', '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', 'Contee', 'All', 'Samuel', 'Henry']\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: ['Benjamin Contee', '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 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 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:\nState all the district that Benjamin Contee has served before.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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_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 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 last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['January', '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 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 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 `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 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:\nat the term of 4th of January 2001 refers to start = '2001-04-01';\nState the address of Amy Klobuchar at the term of 4th of January 2001.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.address FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Amy' AND T1.last_name = 'Klobuchar' AND T2.start = '2001-04-01'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.address FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Amy' AND T1.last_name = 'Klobuchar' AND T2.start = '2001-04-01'", "index": 2403, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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_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 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 last_name text, -- example: ['Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n middle_name text, -- example: ['January', '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 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 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 `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 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:\nat the term of 4th of January 2001 refers to start = '2001-04-01';\nState the address of Amy Klobuchar at the term of 4th of January 2001.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 (\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 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', 'All', 'Samuel', 'Henry']\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 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_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` (\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 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 `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 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 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 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:\njunior senators refers to state_rank = 'junior'; in 1997 refers to start like '1997%';\nList all the junior senators in 1997.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.first_name, T1.last_name FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.start LIKE '1997%' AND T2.state_rank = 'junior'", "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.start LIKE '1997%' AND T2.state_rank = 'junior'", "index": 2404, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 (\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 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', 'All', 'Samuel', 'Henry']\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 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_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` (\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 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 `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 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 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 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:\njunior senators refers to state_rank = 'junior'; in 1997 refers to start like '1997%';\nList all the junior senators in 1997.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `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: ['CA', '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 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 `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: ['CA', '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 `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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale legislators refers to gender_bio = 'F'; representatives refers to type = 'rep'; for California refers to state = 'CA'; in 2015 refers to the year of start date is '2015';\nHow many female legislators become representatives for California in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE STRFTIME('%Y', T2.start) = '2015' AND T2.state = 'CA' AND T1.gender_bio = 'F'", "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 STRFTIME('%Y', T2.start) = '2015' AND T2.state = 'CA' AND T1.gender_bio = 'F'", "index": 2405, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['CA', '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 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 `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: ['CA', '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 `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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale legislators refers to gender_bio = 'F'; representatives refers to type = 'rep'; for California refers to state = 'CA'; in 2015 refers to the year of start date is '2015';\nHow many female legislators become representatives for California in 2015?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `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: ['ID', '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: ['Emanuel', '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: ['Cleaver', '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: ['Emanuel', 'L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Emanuel Cleaver', '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: ['Emanuel Cleaver', 'Sherrod Brown', 'Maria Cantwell']\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 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: ['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 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: ['Emanuel', '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: ['Emanuel', '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: ['Emanuel', '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:\nWhat is the Twitter ID of Emanuel Cleaver?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.twitter_id FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Emanuel' AND T2.last_name = 'Cleaver'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.twitter_id FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Emanuel' AND T2.last_name = 'Cleaver'", "index": 2406, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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-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: ['ID', '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: ['Emanuel', '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: ['Cleaver', '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: ['Emanuel', 'L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n official_full_name text, -- example: ['Emanuel Cleaver', '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: ['Emanuel Cleaver', 'Sherrod Brown', 'Maria Cantwell']\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 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: ['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 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: ['Emanuel', '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: ['Emanuel', '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: ['Emanuel', '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:\nWhat is the Twitter ID of Emanuel Cleaver?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 gender_bio text, -- example: ['M', 'F']\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 nickname_name text, -- nickname, example: ['Bob', 'Bernie']\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);\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 thomas integer, -- example: [2222, 2019]\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-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 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: ['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 historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\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 middle_name text, -- example: ['All', '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 `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 party text, -- example: ['Democrat', '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: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', '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:\nState all the Facebook ID for current legislators under the democrat 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.facebook_id FROM `current-terms` AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide = T2.bioguide WHERE T1.party = 'Democrat' GROUP BY T2.facebook_id", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.facebook_id FROM `current-terms` AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide = T2.bioguide WHERE T1.party = 'Democrat' GROUP BY T2.facebook_id", "index": 2407, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 gender_bio text, -- example: ['M', 'F']\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 nickname_name text, -- nickname, example: ['Bob', 'Bernie']\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);\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 thomas integer, -- example: [2222, 2019]\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-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 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: ['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 historical (\n bioguide_id text, -- example: ['A000001', 'A000002']\n first_name text, -- example: ['Richard', 'Theodorick']\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 middle_name text, -- example: ['All', '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 `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 party text, -- example: ['Democrat', '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: ['1789-03-04', '1790-01-01']\n state text, -- example: ['ID', '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:\nState all the Facebook ID for current legislators under the democrat 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 bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n `end` text, -- example: ['1791-03-03', '1793-03-03']\n last text, -- example: ['Levy', 'Lambert']\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 `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);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\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 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 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 last_name text, -- example: ['Bassett', 'Bland']\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 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 first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\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 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:\nfemale legislator refers to gender_bio = 'F'; term ended on the 3rd of March 1791 refers to end = '1791-03-03';\nWhich historical female legislator that have their term ended on the 3rd of March 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.end = '1791-03-03' AND T1.gender_bio = 'F'", "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.end = '1791-03-03' AND T1.gender_bio = 'F'", "index": 2408, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `end` text, -- example: ['1791-03-03', '1793-03-03']\n last text, -- example: ['Levy', 'Lambert']\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 `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);\n\nCREATE TABLE `current-terms` (\n bioguide text, -- bioguide id, example: ['A000055', 'A000360']\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 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 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 last_name text, -- example: ['Bassett', 'Bland']\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 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 first_name text, -- example: ['Sherrod', 'Maria']\n gender_bio text, -- example: ['F', 'M']\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 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:\nfemale legislator refers to gender_bio = 'F'; term ended on the 3rd of March 1791 refers to end = '1791-03-03';\nWhich historical female legislator that have their term ended on the 3rd of March 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 `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 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 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 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 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 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 state text, -- example: ['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-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 `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 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:\nratio = DIVIDE(COUNT(current.bioguide_id WHERE current.wikipedia_id is not null), COUNT(historical.bioguide_id WHERE historical.wikipedia_id is not null)); famous current legislators refers to current.wikipedia_id is not null; famous historical legislators refers to historical.wikipedia_id is not null;\nWhat is the ratio between famous current legislators and famous historical 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 CAST(COUNT(CASE WHEN wikipedia_id IS NOT NULL THEN bioguide_id ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(CASE WHEN wikipedia_id IS NOT NULL THEN bioguide_id ELSE 0 END) FROM historical ) FROM current", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN wikipedia_id IS NOT NULL THEN bioguide_id ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(CASE WHEN wikipedia_id IS NOT NULL THEN bioguide_id ELSE 0 END) FROM historical ) FROM current", "index": 2409, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 (\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 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 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 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 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 state text, -- example: ['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-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 `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 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:\nratio = DIVIDE(COUNT(current.bioguide_id WHERE current.wikipedia_id is not null), COUNT(historical.bioguide_id WHERE historical.wikipedia_id is not null)); famous current legislators refers to current.wikipedia_id is not null; famous historical legislators refers to historical.wikipedia_id is not null;\nWhat is the ratio between famous current legislators and famous historical 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-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 middle text,\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 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 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 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 maplight_id text, -- example: ['232.0', '581.0']\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 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 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: ['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: ['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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsenators refers to type = 'sen';\nHow many class 1 senators belong to 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 COUNT(bioguide) FROM `current-terms` WHERE class = 1 AND party = 'Republican'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(bioguide) FROM `current-terms` WHERE class = 1 AND party = 'Republican'", "index": 2410, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 middle text,\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 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 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 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 maplight_id text, -- example: ['232.0', '581.0']\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 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 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: ['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: ['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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsenators refers to type = 'sen';\nHow many class 1 senators belong to 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 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 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 `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 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` (\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 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 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 thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names = first_name, last_name; non-google entity refers to google_entity_id_id is null; female refers to gender_bio = 'F'; have not been registered in Federal Election Commission data refers to fec_id is null;\nWhat are the full names of the non-google female entity legislators that 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 first_name, last_name FROM historical WHERE gender_bio = 'F' AND google_entity_id_id IS NULL AND fec_id IS NULL", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT first_name, last_name FROM historical WHERE gender_bio = 'F' AND google_entity_id_id IS NULL AND fec_id IS NULL", "index": 2411, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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` (\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 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 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 thomas integer, -- example: [2222, 2019]\n twitter text, -- example: ['RepAmata', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names = first_name, last_name; non-google entity refers to google_entity_id_id is null; female refers to gender_bio = 'F'; have not been registered in Federal Election Commission data refers to fec_id is null;\nWhat are the full names of the non-google female entity legislators that 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 `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: ['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: ['Jewish', '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` (\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: ['Jewish', '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 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:\nJewish legislators refers to religion_bio = 'Jewish'; do not have facebook refers to facebook is null;\nHow many Jewish legislators do not have facebook?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bioguide_id) FROM ( SELECT T1.bioguide_id FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NULL GROUP BY T1.bioguide_id ) T3", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(T3.bioguide_id) FROM ( SELECT T1.bioguide_id FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NULL GROUP BY T1.bioguide_id ) T3", "index": 2412, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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: ['Jewish', '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` (\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: ['Jewish', '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 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:\nJewish legislators refers to religion_bio = 'Jewish'; do not have facebook refers to facebook is null;\nHow many Jewish legislators do not have facebook?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['Baptist', '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 `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 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 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 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 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 first_name text, -- example: ['Max', '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 lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Baptiste', '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 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 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_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:\nparty that has the highest number of legislators refers to MAX(COUNT(party)); Baptist refers to religion_bio = 'Baptist';\nWhich party has the highest number of legislators who are Baptist?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.religion_bio = 'Baptist' GROUP BY T2.party ORDER BY COUNT(T2.party) DESC LIMIT 1", "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.religion_bio = 'Baptist' GROUP BY T2.party ORDER BY COUNT(T2.party) DESC LIMIT 1", "index": 2413, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['Baptist', '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 `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 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 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 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 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 first_name text, -- example: ['Max', '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 lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Baptiste', '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 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 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_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:\nparty that has the highest number of legislators refers to MAX(COUNT(party)); Baptist refers to religion_bio = 'Baptist';\nWhich party has the highest number of legislators who are Baptist?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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 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 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 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 lis_id text, -- legislator id, example: ['S134', 'S135']\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-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 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 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 `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:\nhave facebook, instagram, twitter and youtube accounts refers to 'facebook' is not null AND 'instagram' is not null AND 'twitter' is not null AND 'youtube' is not null;\nList the official full names of all the legislators who have facebook, instagram, twitter and youtube accounts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NOT NULL AND T2.instagram IS NOT NULL AND T2.twitter IS NOT NULL AND T2.youtube IS NOT NULL", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NOT NULL AND T2.instagram IS NOT NULL AND T2.twitter IS NOT NULL AND T2.youtube IS NOT NULL", "index": 2414, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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 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 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 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 lis_id text, -- legislator id, example: ['S134', 'S135']\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-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 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 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 `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:\nhave facebook, instagram, twitter and youtube accounts refers to 'facebook' is not null AND 'instagram' is not null AND 'twitter' is not null AND 'youtube' is not null;\nList the official full names of all the legislators who have facebook, instagram, twitter and youtube accounts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 first_name text, -- example: ['John', '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 last_name text, -- example: ['John', '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: ['John', 'Jr.', '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 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 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 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 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 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 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` (\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 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: ['Conyers', 'Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['John Conyers, Jr.', '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:\nHow many districts did John Conyers, Jr. serve in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.district) FROM ( SELECT T2.district FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'John Conyers, Jr.' GROUP BY T2.district ) T3", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(T3.district) FROM ( SELECT T2.district FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'John Conyers, Jr.' GROUP BY T2.district ) T3", "index": 2415, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 first_name text, -- example: ['John', '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 last_name text, -- example: ['John', '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: ['John', 'Jr.', '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 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 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 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 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 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 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` (\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 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: ['Conyers', 'Brown', 'Cantwell']\n maplight_id real, -- example: [168.0, 544.0]\n official_full_name text, -- example: ['John Conyers, Jr.', '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:\nHow many districts did John Conyers, Jr. serve in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 `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 `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\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);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n govtrack_id integer, -- example: [400050, 300018]\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 (\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 first_name text, -- example: ['Page', 'Richard', 'Theodorick']\n govtrack_id integer, -- example: [401222, 401521]\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 `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 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 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:\nWikipedia page names refers to wikipedia_id; anti-administration refers to party = 'Anti-Administration'; senators refers to type = 'sen';\nWhat are the Wikipedia page names of all the anti-administration 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 T1.wikipedia_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.party = 'Anti-Administration'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.wikipedia_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'sen' AND T2.party = 'Anti-Administration'", "index": 2416, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 `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 `start` text, -- example: ['1993-01-05', '1995-01-04']\n title text, -- example: ['Minority Whip', 'Majority Whip']\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);\n\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n govtrack_id integer, -- example: [400050, 300018]\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 (\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 first_name text, -- example: ['Page', 'Richard', 'Theodorick']\n govtrack_id integer, -- example: [401222, 401521]\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 `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 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 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:\nWikipedia page names refers to wikipedia_id; anti-administration refers to party = 'Anti-Administration'; senators refers to type = 'sen';\nWhat are the Wikipedia page names of all the anti-administration 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 `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 official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_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 name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\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 district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\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 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 lis_id text, -- legislator id, example: ['S134', 'S135']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\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:\nserved only one district for 26 consecutive years refers to SUBTRACT(SUM(cast(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 26\nList the official full names of all the legislators that served 13 district for 26 consecutive years.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 26 THEN T1.official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T1.official_full_name, T2.district HAVING COUNT(T1.official_full_name) = 13", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT DISTINCT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 26 THEN T1.official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T1.official_full_name, T2.district HAVING COUNT(T1.official_full_name) = 13", "index": 2417, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 official_full_name text, -- example: ['Sherrod Brown', 'Maria Cantwell']\n PRIMARY KEY (bioguide_id, cspan_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 name text, -- example: ['Stewart Lee Udall', 'Morris K. Udall']\n party text, -- example: ['Democrat', 'Republican']\n `start` text, -- example: ['1993-01-05', '1995-01-04']\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 district real, -- example: [9.0, 2.0]\n `end` text, -- example: ['1793-03-03', '1791-03-03']\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 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 lis_id text, -- legislator id, example: ['S134', 'S135']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\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:\nserved only one district for 26 consecutive years refers to SUBTRACT(SUM(cast(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 26\nList the official full names of all the legislators that served 13 district for 26 consecutive years.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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-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: ['Federalist', '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 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-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 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 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: ['Benjamin', '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: ['Benjamin', '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', '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 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 thomas integer, -- example: [2222, 2019]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFederalist refers to party = 'Federalist'; representatives refers to type = 'rep';\nHow many Federalist representatives are there whose first names are Benjamin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T.bioguide_id) FROM ( SELECT T1.bioguide_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T2.party = 'Federalist' AND T2.type = 'rep' GROUP BY T1.bioguide_id ) AS T", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(T.bioguide_id) FROM ( SELECT T1.bioguide_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Benjamin' AND T2.party = 'Federalist' AND T2.type = 'rep' GROUP BY T1.bioguide_id ) AS T", "index": 2418, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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-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: ['Federalist', '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 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-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 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 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: ['Benjamin', '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: ['Benjamin', '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', '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 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 thomas integer, -- example: [2222, 2019]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFederalist refers to party = 'Federalist'; representatives refers to type = 'rep';\nHow many Federalist representatives are there whose first names are Benjamin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 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 `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: ['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 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 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 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 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 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:\nfemale refers to gender_bio = 'F'; representatives refers to type = 'rep'; served for at least 10 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) > 10;\nHow many female representatives served in the state of California for at least 10 years?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.result) FROM ( SELECT CASE WHEN SUM(CAST(strftime('%Y', T2.`end`) AS int) - CAST(strftime('%Y', T2.start) AS int)) > 10 THEN 1 ELSE 0 END AS result FROM current AS T1 INNER JOIN \"current-terms\" AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND T2.state = 'CA' AND T2.type = 'rep' ) AS T3", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT SUM(T3.result) FROM ( SELECT CASE WHEN SUM(CAST(strftime('%Y', T2.`end`) AS int) - CAST(strftime('%Y', T2.start) AS int)) > 10 THEN 1 ELSE 0 END AS result FROM current AS T1 INNER JOIN \"current-terms\" AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.gender_bio = 'F' AND T2.state = 'CA' AND T2.type = 'rep' ) AS T3", "index": 2419, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 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 `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: ['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 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 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 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 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 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:\nfemale refers to gender_bio = 'F'; representatives refers to type = 'rep'; served for at least 10 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) > 10;\nHow many female representatives served in the state of California for at least 10 years?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `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_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 `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 (\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 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 official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Lutheran', 'Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\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 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 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 wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\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 `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 phone text, -- example: ['202-224-4024', '202-224-4543']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\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 `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLutheran refers to religion_bio = 'Lutheran'; representative refers to type = 'rep'; served for 14 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 14;\nWho is the Lutheran representative that served in the state of Ohio for 14 years before becoming a 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 CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 14 THEN official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.religion_bio = 'Lutheran' AND T2.state = 'OH' AND T2.type = 'rep'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CASE WHEN SUM(CAST(strftime('%Y', T2.end) AS int) - CAST(strftime('%Y', T2.start) AS int)) = 14 THEN official_full_name END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.religion_bio = 'Lutheran' AND T2.state = 'OH' AND T2.type = 'rep'", "index": 2420, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `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_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 `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 (\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 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 official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\n opensecrets_id text, -- example: ['N00008333', 'N00006953']\n religion_bio text, -- example: ['Lutheran', 'Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\n votesmart_id text, -- example: ['52156.0', '128775.0']\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 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 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 wikipedia_id text, -- example: ['Sherrod Brown', 'Maria Cantwell']\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 `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 phone text, -- example: ['202-224-4024', '202-224-4543']\n `start` text, -- example: ['1789-03-04', '1790-01-01']\n state text, -- example: ['DE', 'VA']\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 `social-media` (\n bioguide text, -- example: ['A000055', 'A000360']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLutheran refers to religion_bio = 'Lutheran'; representative refers to type = 'rep'; served for 14 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 14;\nWho is the Lutheran representative that served in the state of Ohio for 14 years before becoming a 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` (\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 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 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 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 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 `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_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 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 phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\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 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 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:\nborn after the year 1960 refers to strftime('%Y', birthday_bio) > '1960'; not google entities refers to google_entity_id_id is null;\nAmong all the current legislators born after the year 1960, how many of them are not google entities?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 strftime('%Y', birthday_bio) > '1960' AND google_entity_id_id IS NULL", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current WHERE strftime('%Y', birthday_bio) > '1960' AND google_entity_id_id IS NULL", "index": 2421, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 `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_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 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 phone text, -- example: ['202-224-2315', '202-224-3441']\n relation text, -- example: ['son', 'nephew']\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 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 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:\nborn after the year 1960 refers to strftime('%Y', birthday_bio) > '1960'; not google entities refers to google_entity_id_id is null;\nAmong all the current legislators born after the year 1960, how many of them are not google entities?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 `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_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 `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 phone text, -- example: ['202-224-4024', '202-224-4543']\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 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 office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\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_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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave both accounts on both VoteView.com and maplight.org refers to icpsr_id is not null AND maplight_id is not null;\nHow many current legislators have both accounts on both VoteView.com and maplight.org?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 icpsr_id IS NOT NULL AND maplight_id IS NOT NULL", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT COUNT(*) FROM current WHERE icpsr_id IS NOT NULL AND maplight_id IS NOT NULL", "index": 2422, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 `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_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 `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 phone text, -- example: ['202-224-4024', '202-224-4543']\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 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 office text, -- example: ['713 Hart Senate Office Building', '311 Hart Senate Office Building']\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_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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave both accounts on both VoteView.com and maplight.org refers to icpsr_id is not null AND maplight_id is not null;\nHow many current legislators have both accounts on both VoteView.com and maplight.org?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 (\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: ['Sherrod', 'Richard', 'Theodorick']\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: ['Sherrod', 'Brown', '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: ['Brown', 'Samuel', 'Henry']\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 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 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 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 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:\nreligion refers to religion_bio;\nWhat is the religion of current legislator Sherrod Brown?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT religion_bio FROM current WHERE official_full_name = 'Sherrod Brown'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT religion_bio FROM current WHERE official_full_name = 'Sherrod Brown'", "index": 2423, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 (\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: ['Sherrod', 'Richard', 'Theodorick']\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: ['Sherrod', 'Brown', '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: ['Brown', 'Samuel', 'Henry']\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 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 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 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 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:\nreligion refers to religion_bio;\nWhat is the religion of current legislator Sherrod Brown?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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` (\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 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-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);\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 current official Facebook presence of the legislators refers to facebook; legislators that are famous or impact refers to wikipedia_id is not null;\nPlease list the username of the current official Facebook presence of all the current legislators that are famous or impact.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.bioguide_id = T2.bioguide WHERE T1.wikipedia_id IS NOT NULL GROUP BY T2.facebook", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.wikipedia_id IS NOT NULL GROUP BY T2.facebook", "index": 2424, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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` (\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 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-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);\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 current official Facebook presence of the legislators refers to facebook; legislators that are famous or impact refers to wikipedia_id is not null;\nPlease list the username of the current official Facebook presence of all the current legislators that are famous or impact.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `start` text, -- example: ['2013-01-03', '1789-03-04', '1790-01-01']\n state text, -- example: ['HI', 'DC', '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 cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\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 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 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 first_name text, -- example: ['Washington', 'Sherrod', '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 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 religion_bio text, -- example: ['Baptist', 'Roman Catholic']\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 chamber text, -- example: ['senate', 'house']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['2013-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 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 relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['2013-01-03', '1993-01-05', '1995-01-04']\n state text, -- example: ['HI', 'DC', '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 `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 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:\nWashington, DC office phone number refers to phone; terms starting on 2013/1/3 refers to start = '2013-01-03';\nWhat was current legislator Sherrod Brown's Washington, D.C. office phone number during his term starting on 2013/1/3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.phone FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Sherrod Brown' AND T1.start = '2013-01-03'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.phone FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Sherrod Brown' AND T1.start = '2013-01-03'", "index": 2425, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `start` text, -- example: ['2013-01-03', '1789-03-04', '1790-01-01']\n state text, -- example: ['HI', 'DC', '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 cspan_id real, -- example: [45516.0, 5.0]\n first_name text, -- example: ['Sherrod', 'Maria']\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 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 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 first_name text, -- example: ['Washington', 'Sherrod', '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 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 religion_bio text, -- example: ['Baptist', 'Roman Catholic']\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 chamber text, -- example: ['senate', 'house']\n district real, -- example: [13.0, 1.0]\n `end` text, -- example: ['2013-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 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 relation text, -- example: ['son', 'nephew']\n `start` text, -- example: ['2013-01-03', '1993-01-05', '1995-01-04']\n state text, -- example: ['HI', 'DC', '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 `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 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:\nWashington, DC office phone number refers to phone; terms starting on 2013/1/3 refers to start = '2013-01-03';\nWhat was current legislator Sherrod Brown's Washington, D.C. office phone number during his term starting on 2013/1/3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `current` (\n bioguide_id text, -- example: ['A000055', 'A000360']\n cspan_id real, -- example: [45516.0, 5.0]\n gender_bio text, -- example: ['F', 'M']\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 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 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: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\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 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 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 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 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 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: ['2013-01-03', '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 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: ['2013-01-03', '1789-03-04', '1790-01-01']\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 chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['2013-01-03', '2013-01-02', '1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\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: ['2013-01-03', '1993-01-05', '1995-01-04']\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:\nterm starting on 2013/1/3 refers to start = '2013-01-03; female refers to gender_bio = 'F';\nAmong the current legislators who served the term starting on 2013/1/3, how many of them are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.start = '2013-01-03' AND T1.gender_bio = 'F'", "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.start = '2013-01-03' AND T1.gender_bio = 'F'", "index": 2426, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 gender_bio text, -- example: ['F', 'M']\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 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 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: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\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 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 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 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 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 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: ['2013-01-03', '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 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: ['2013-01-03', '1789-03-04', '1790-01-01']\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 chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['2013-01-03', '2013-01-02', '1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\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: ['2013-01-03', '1993-01-05', '1995-01-04']\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:\nterm starting on 2013/1/3 refers to start = '2013-01-03; female refers to gender_bio = 'F';\nAmong the current legislators who served the term starting on 2013/1/3, how many of them are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 `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 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 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: ['More', 'All', 'Samuel', 'Henry']\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 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:\nhave served for more than 4 years refers to count(bioguide) > 4; percentage = MULTIPLY(DIVIDE(SUM(gender_bio = 'F'), count(bioguide)), 100.0); female refers to gender_bio = 'F'\nAmong all the current legislators who have served for more than 4 terms, what is the percentage of them being female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.bioguide) FROM ( SELECT T2.bioguide, T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 ) T3", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.bioguide) FROM ( SELECT T2.bioguide, T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 ) T3", "index": 2427, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 `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 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 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: ['More', 'All', 'Samuel', 'Henry']\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 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:\nhave served for more than 4 years refers to count(bioguide) > 4; percentage = MULTIPLY(DIVIDE(SUM(gender_bio = 'F'), count(bioguide)), 100.0); female refers to gender_bio = 'F'\nAmong all the current legislators who have served for more than 4 terms, what is the percentage of them being female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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: ['Benjamin', '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 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 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 `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 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 fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\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 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: ['Benjamin', 'Hawkins', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\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 wikipedia_id text, -- example: ['Benjamin Hawkins', '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 contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInstagram username refers to instagram;\nProvide the Instagram username of the legislator named 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 T1.instagram FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Benjamin' AND T2.last_name = 'Hawkins'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.instagram FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Benjamin' AND T2.last_name = 'Hawkins'", "index": 2428, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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: ['Benjamin', '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 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 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 `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 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 fec_id text, -- example: [\"['S6CO00168']\", \"['S2MN00126']\"]\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 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: ['Benjamin', 'Hawkins', 'Bassett', 'Bland']\n lis_id text, -- legislator id, example: ['S134', 'S135']\n maplight_id text, -- example: ['232.0', '581.0']\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 wikipedia_id text, -- example: ['Benjamin Hawkins', '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 contact_form text, -- example: ['http://www.webb.senate.gov/contact.cfm', 'http://www.scottbrown.senate.gov/public/']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInstagram username refers to instagram;\nProvide the Instagram username of the legislator named 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 `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 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_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 `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['NE', 'ID', 'OH', 'WA']\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 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 last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n religion_bio text, -- example: ['Catholic', '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 `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 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 (\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 google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\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: ['Catholic', 'Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\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 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 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: ['NE', 'ID', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalphanumeric ID refers to bioguide; Catholic legislators refers to religion_bio = 'Catholic'; Nebraska refers to state = 'NE';\nGive the alphanumeric ID of the Catholic legislators in Nebraska.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.bioguide FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.religion_bio = 'Catholic' AND T1.state = 'NE'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T1.bioguide FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.religion_bio = 'Catholic' AND T1.state = 'NE'", "index": 2429, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `start` text, -- example: ['1993-01-05', '1995-01-04']\n state text, -- example: ['NE', 'ID', 'OH', 'WA']\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 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 last_name text, -- example: ['Brown', 'Cantwell']\n middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n religion_bio text, -- example: ['Catholic', '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 `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 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 (\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 google_entity_id_id text, -- google entity id, example: ['kg:/m/02pz46', 'kg:/m/033mf4']\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: ['Catholic', 'Baptist', 'Roman Catholic']\n suffix_name text, -- example: ['Jr.', 'Sr.']\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 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 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: ['NE', 'ID', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalphanumeric ID refers to bioguide; Catholic legislators refers to religion_bio = 'Catholic'; Nebraska refers to state = 'NE';\nGive the alphanumeric ID of the Catholic legislators in Nebraska.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n ballotpedia_id text, -- example: ['Mo Cowan', 'Jo Bonner']\n bioguide_id text, -- example: ['A000001', 'A000002']\n birthday_bio text, -- example: ['1727-11-26', '1745-04-02', '1742-03-21']\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 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 nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n PRIMARY KEY (bioguide_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);\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 govtrack_id integer, -- example: [400050, 300018]\n lis_id text, -- legislator id, example: ['S307', 'S275']\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 `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\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_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 bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstart date of the term refers to start; born on November 26, 1727 refers to birthday_bio = '1727-11-26';\nGive the type and start date of the term of the legislator born on November 26, 1727.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.type, T2.start FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = '1727-11-26'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT T2.type, T2.start FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = '1727-11-26'", "index": 2430, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 birthday_bio text, -- example: ['1727-11-26', '1745-04-02', '1742-03-21']\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 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 nickname_name text, -- nickname, example: ['of Carrollton', 'of Colchester']\n PRIMARY KEY (bioguide_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);\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 govtrack_id integer, -- example: [400050, 300018]\n lis_id text, -- legislator id, example: ['S307', 'S275']\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 `historical-terms` (\n bioguide text, -- bioguide id, example: ['A000001', 'A000002']\n chamber text, -- example: ['house', 'senate']\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_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 bioguide text, -- bioguide id, example: ['A000055', 'A000360']\n chamber text, -- example: ['senate', 'house']\n `end` text, -- example: ['1999-01-03', '2001-01-03']\n last text, -- example: ['Menendez']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstart date of the term refers to start; born on November 26, 1727 refers to birthday_bio = '1727-11-26';\nGive the type and start date of the term of the legislator born on November 26, 1727.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\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 last_name text, -- example: ['Crawford', 'Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\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-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 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 `start` text, -- example: ['1993-01-05', '1995-01-04']\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-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 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 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` (\n ballotpedia_id text, -- example: ['Rick Crawford', '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 gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Crawford', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\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 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_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\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:\nWhat is the contact form of the legislator named Rick Crawford?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 = 'Rick Crawford'", "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 = 'Rick Crawford'", "index": 2431, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 bioguide_previous_id text, -- example: [\"['F000246']\", \"['L000266']\"]\n birthday_bio text, -- example: ['1745-04-02', '1742-03-21']\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 last_name text, -- example: ['Crawford', 'Bassett', 'Bland']\n official_full_name text, -- example: ['Enid Greene Waldholtz', 'Jesse L. Jackson Jr.']\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-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 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 `start` text, -- example: ['1993-01-05', '1995-01-04']\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-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 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 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` (\n ballotpedia_id text, -- example: ['Rick Crawford', '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 gender_bio text, -- example: ['M', 'F']\n last_name text, -- example: ['Crawford', 'Brown', 'Cantwell']\n lis_id text, -- legislator id, example: ['S307', 'S275']\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 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_id real, -- example: [1537155909907320.0, 186203844738421.0]\n instagram_id real, -- example: [1582702853.0, 515327940.0]\n thomas integer, -- example: [2222, 2019]\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:\nWhat is the contact form of the legislator named Rick Crawford?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\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 `current-terms` (\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 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 relation text, -- example: ['son', 'nephew']\n state text, -- example: ['ME', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\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 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 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 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: ['ME', '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 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 gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n last_name text, -- example: ['Main', 'Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Main', '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 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 govtrack real, -- example: [412664.0, 412428.0]\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:\nfemale refers to gender_bio = 'F'; percentage = MULTIPLY(DIVIDE(SUM(type = 'sen'), COUNT(type)), 100.0); senators refers to type = 'sen'; Maine refers to state = 'ME';\nAmong the female legislators, what is the percentage of the senators in Maine?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.type) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'ME' AND T1.gender_bio = 'F'", "style": "rule" }
{ "db_id": "legislator.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.type) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'ME' AND T1.gender_bio = 'F'", "index": 2432, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 middle_name text, -- example: ['L.', 'Richard']\n nickname_name text, -- nickname, example: ['Bob', 'Bernie']\n opensecrets_id text, -- example: ['N00003535', 'N00007836']\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 `current-terms` (\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 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 relation text, -- example: ['son', 'nephew']\n state text, -- example: ['ME', 'OH', 'WA']\n state_rank text, -- example: ['senior', 'junior']\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 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 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 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: ['ME', '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 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 gender_bio text, -- example: ['F', 'M']\n govtrack_id integer, -- example: [401222, 401521]\n last_name text, -- example: ['Main', 'Bassett', 'Bland']\n maplight_id text, -- example: ['232.0', '581.0']\n middle_name text, -- example: ['Main', '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 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 govtrack real, -- example: [412664.0, 412428.0]\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:\nfemale refers to gender_bio = 'F'; percentage = MULTIPLY(DIVIDE(SUM(type = 'sen'), COUNT(type)), 100.0); senators refers to type = 'sen'; Maine refers to state = 'ME';\nAmong the female legislators, what is the percentage of the senators in Maine?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1994 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['John Aalberg', 'A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow old was he refers to age; 1994 Winter refers to games_name = '1994 Winter';\nWhen John Aalberg took part in the 1994 Winter Olympic Game, how old was he?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.age FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T1.games_name = '1994 Winter'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.age FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T1.games_name = '1994 Winter'", "index": 2433, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1994 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['John Aalberg', 'A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow old was he refers to age; 1994 Winter refers to games_name = '1994 Winter';\nWhen John Aalberg took part in the 1994 Winter Olympic Game, how old was he?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['F', 'M']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Finland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompetitors from Finland refer to id where region_name = 'Finland'; female refers to gender = 'F';\nAmong all the Olympic competitors from Finland, how many of them are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'F'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T3.id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'F'", "index": 2434, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['F', 'M']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Finland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompetitors from Finland refer to id where region_name = 'Finland'; female refers to gender = 'F';\nAmong all the Olympic competitors from Finland, how many of them are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['London', 'Barcelona']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which year refers to games_year; London refers to city_name = 'London'; earliest Olympic game refers to MIN(games_year);\nIn which year did London hold its earliest Olympic game?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.games_year FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'London' ORDER BY T3.games_year LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T3.games_year FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'London' ORDER BY T3.games_year LIMIT 1", "index": 2435, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['London', 'Barcelona']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which year refers to games_year; London refers to city_name = 'London'; earliest Olympic game refers to MIN(games_year);\nIn which year did London hold its earliest Olympic game?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['London', 'Barcelona']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLondon refers to city_name = 'London'; how many times refer to COUNT(games_id);\nFor how many times has London held the Olympic games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.games_id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE T2.city_name = 'London'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T1.games_id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE T2.city_name = 'London'", "index": 2436, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['London', 'Barcelona']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLondon refers to city_name = 'London'; how many times refer to COUNT(games_id);\nFor how many times has London held the Olympic games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Finland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(height), COUNT(id)) where region_name = 'Finland' and gender = 'M';\nWhat is the average height of the male Olympic competitors from Finland?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T3.height) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'M'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT AVG(T3.height) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'M'", "index": 2437, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Finland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(height), COUNT(id)) where region_name = 'Finland' and gender = 'M';\nWhat is the average height of the male Olympic competitors from Finland?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Finland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1994 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(id where region_name = 'Finland'), COUNT(id)) as percentage where games_name = '1994 Winter';\nAmong the competitors of the 1994 Winter Olympic Game, what is the percentage of those from Finland?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T5.region_name = 'Finland' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id INNER JOIN person_region AS T4 ON T3.id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.games_name = '1994 Winter'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T5.region_name = 'Finland' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id INNER JOIN person_region AS T4 ON T3.id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.games_name = '1994 Winter'", "index": 2438, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Finland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1994 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(id where region_name = 'Finland'), COUNT(id)) as percentage where games_name = '1994 Winter';\nAmong the competitors of the 1994 Winter Olympic Game, what is the percentage of those from Finland?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Swimming', 'Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nswimming refers to sport_name = 'Swimming';\nTell the number of swimming related events.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.event_name) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Swimming'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.event_name) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Swimming'", "index": 2439, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Swimming', 'Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nswimming refers to sport_name = 'Swimming';\nTell the number of swimming related events.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Jessica Carolina Aguilera Aguilera', 'Ana Carolina Aguilera', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nid of the game refers to games_id;\nWhich game has Jessica Carolina Aguilera Aguilera participated in? Give the id of the game.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_id FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Jessica Carolina Aguilera Aguilera'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.games_id FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Jessica Carolina Aguilera Aguilera'", "index": 2440, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Jessica Carolina Aguilera Aguilera', 'Ana Carolina Aguilera', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nid of the game refers to games_id;\nWhich game has Jessica Carolina Aguilera Aguilera participated in? Give the id of the game.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Sweden', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (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 tallest athlete refers to id where MAX(height); from Sweden refers to region_name = 'Sweden'; name refers to full_name;\nGive the name of the tallest athlete from Sweden.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.full_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Sweden' ORDER BY T3.height DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T3.full_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Sweden' ORDER BY T3.height DESC LIMIT 1", "index": 2441, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Sweden', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (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 tallest athlete refers to id where MAX(height); from Sweden refers to region_name = 'Sweden'; name refers to full_name;\nGive the name of the tallest athlete from Sweden.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Guatemala', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom Guatemala refers to region_name = 'Guatemala';\nHow many athletes in the database are from Guatemala?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.person_id) FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Guatemala'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T1.person_id) FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Guatemala'", "index": 2442, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Guatemala', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom Guatemala refers to region_name = 'Guatemala';\nHow many athletes in the database are from Guatemala?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho is the youngest person refers to full_name where MIN(age);\nWho is the youngest person who participated in the Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id ORDER BY T2.age LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id ORDER BY T2.age LIMIT 1", "index": 2443, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho is the youngest person refers to full_name where MIN(age);\nWho is the youngest person who participated in the Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n24 years old competitors refer to id where age = 24; Men's Basketball refers to event_name = 'Basketball Men''s Basketball';\nHow many 24 years old competitors competed in Men's Basketball?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN event AS T3 ON T1.event_id = T3.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball' AND T2.age = 24", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN event AS T3 ON T1.event_id = T3.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball' AND T2.age = 24", "index": 2444, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n24 years old competitors refer to id where age = 24; Men's Basketball refers to event_name = 'Basketball Men''s Basketball';\nHow many 24 years old competitors competed in Men's Basketball?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Henk Jan Zwolle', 'A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngold medals refer to medal_name = 'Gold';\nHow many gold medals does Henk Jan Zwolle have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Henk Jan Zwolle' AND T4.medal_name = 'Gold'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T1.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Henk Jan Zwolle' AND T4.medal_name = 'Gold'", "index": 2445, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Henk Jan Zwolle', 'A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngold medals refer to medal_name = 'Gold';\nHow many gold medals does Henk Jan Zwolle 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 competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreceived the most gold medals refers to MAX(COUNT(medal_name = 'Gold'));\nWhat is the name of the event where competitors received the most gold medals?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.event_name FROM competitor_event AS T1 INNER JOIN event AS T2 ON T1.event_id = T2.id INNER JOIN medal AS T3 ON T1.medal_id = T3.id WHERE T3.medal_name = 'Gold' GROUP BY T2.id ORDER BY COUNT(T1.event_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.event_name FROM competitor_event AS T1 INNER JOIN event AS T2 ON T1.event_id = T2.id INNER JOIN medal AS T3 ON T1.medal_id = T3.id WHERE T3.medal_name = 'Gold' GROUP BY T2.id ORDER BY COUNT(T1.event_id) DESC LIMIT 1", "index": 2446, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreceived the most gold medals refers to MAX(COUNT(medal_name = 'Gold'));\nWhat is the name of the event where competitors received the most gold medals?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Stockholm', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSummer games refer to id where season = 'Summer'; in Stockholm refers to city_name = 'Stockholm';\nHow many Summer games were held in Stockholm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Stockholm' AND T3.season = 'Summer'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T3.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Stockholm' AND T3.season = 'Summer'", "index": 2447, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Stockholm', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSummer games refer to id where season = 'Summer'; in Stockholm refers to city_name = 'Stockholm';\nHow many Summer games were held in Stockholm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; most of the athletes refer to MAX(COUNT(person_id));\nWhich region do most of the athletes are from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1", "index": 2448, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; most of the athletes refer to MAX(COUNT(person_id));\nWhich region do most of the athletes are from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1928 Summer', '1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1992 Summer Olympics refer to games_name = '1928 Summer';\nHow many athletes competed in the 1992 Summer Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1928 Summer'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1928 Summer'", "index": 2449, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1928 Summer', '1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1992 Summer Olympics refer to games_name = '1928 Summer';\nHow many athletes competed in the 1992 Summer Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Michael Fred Phelps, II', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(event_id where medal_name = 'Gold'), COUNT(event_id)) as percentage where full_name = 'Michael Fred Phelps, II';\nHow many Olympic events did Michael Phelps II join in total? Find the percentage of the events where he won a gold medal.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.event_id) , CAST(COUNT(CASE WHEN T4.id = '1' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T4.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Michael Fred Phelps, II'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T3.event_id) , CAST(COUNT(CASE WHEN T4.id = '1' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T4.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Michael Fred Phelps, II'", "index": 2450, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Michael Fred Phelps, II', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(event_id where medal_name = 'Gold'), COUNT(event_id)) as percentage where full_name = 'Michael Fred Phelps, II';\nHow many Olympic events did Michael Phelps II join in total? Find the percentage of the events where he won a gold medal.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage is the most numerous refers to age where MAX(COUNT(person_id));\nWhat age of the competitors is the most numerous?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT age FROM games_competitor GROUP BY age ORDER BY COUNT(person_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT age FROM games_competitor GROUP BY age ORDER BY COUNT(person_id) DESC LIMIT 1", "index": 2451, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage is the most numerous refers to age where MAX(COUNT(person_id));\nWhat age of the competitors is the most numerous?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncities beginning with the letter M refer to city_name LIKE 'M%';\nIn which cities beginning with the letter M have the Olympic Games been held?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT city_name FROM city WHERE city_name LIKE 'M%'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT city_name FROM city WHERE city_name LIKE 'M%'", "index": 2452, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncities beginning with the letter M refer to city_name LIKE 'M%';\nIn which cities beginning with the letter M have the Olympic Games been held?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (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 medal refers to medal_name;\nWhat was the medal that Coleen Dufresne got?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T4.medal_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Coleen Dufresne (-Stewner)'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T4.medal_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Coleen Dufresne (-Stewner)'", "index": 2453, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (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 medal refers to medal_name;\nWhat was the medal that Coleen Dufresne got?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Sapporo', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Sapporo Olympics refer to games_id where city_name = 'Sapporo';\nHow many persons participated in the Sapporo Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.person_id) FROM games_competitor AS T1 INNER JOIN games_city AS T2 ON T1.games_id = T2.games_id INNER JOIN city AS T3 ON T2.city_id = T3.id WHERE T3.city_name = 'Sapporo'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T1.person_id) FROM games_competitor AS T1 INNER JOIN games_city AS T2 ON T1.games_id = T2.games_id INNER JOIN city AS T3 ON T2.city_id = T3.id WHERE T3.city_name = 'Sapporo'", "index": 2454, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Sapporo', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Sapporo Olympics refer to games_id where city_name = 'Sapporo';\nHow many persons participated in the Sapporo Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Morten Aleksander Djupvik', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which Olympic Games refer to games_year;\nIn which Olympic Games has Morten Aleksander Djupvik participated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Morten Aleksander Djupvik'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Morten Aleksander Djupvik'", "index": 2455, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Morten Aleksander Djupvik', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which Olympic Games refer to games_year;\nIn which Olympic Games has Morten Aleksander Djupvik participated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['2014 Winter', '1992 Summer', '2012 Summer']\n season text, -- example: ['Winter', 'Summer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nathletes refer to person_id; 2014 Winter Olympics refer to games_name = '2014 Winter';\nHow many athletes participated in the 2014 Winter Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2014 Winter'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2014 Winter'", "index": 2456, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['2014 Winter', '1992 Summer', '2012 Summer']\n season text, -- example: ['Winter', 'Summer']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nathletes refer to person_id; 2014 Winter Olympics refer to games_name = '2014 Winter';\nHow many athletes participated in the 2014 Winter Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Ice Hockey Men's Ice Hockey\", \"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngold medals given to the winners refer to competitor_id where medal_name = 'Gold'; Ice Hockey Men's Ice Hockey refers to event_name = 'Ice Hockey Men''s Ice Hockey';\nHow many gold medals were given to the winners in the Ice Hockey Men's Ice Hockey event?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.competitor_id) FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id WHERE T1.event_name LIKE 'Ice Hockey Men%s Ice Hockey' AND T2.medal_id = 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.competitor_id) FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id WHERE T1.event_name LIKE 'Ice Hockey Men%s Ice Hockey' AND T2.medal_id = 1", "index": 2457, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Ice Hockey Men's Ice Hockey\", \"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngold medals given to the winners refer to competitor_id where medal_name = 'Gold'; Ice Hockey Men's Ice Hockey refers to event_name = 'Ice Hockey Men''s Ice Hockey';\nHow many gold medals were given to the winners in the Ice Hockey Men's Ice Hockey event?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; the highest medal number refers to MAX(COUNT(medal_id <> 4));\nWhich region has the highest medal number?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T5.region_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person_region AS T4 ON T3.person_id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.id != 4 GROUP BY T5.region_name ORDER BY COUNT(T2.competitor_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T5.region_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person_region AS T4 ON T3.person_id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.id != 4 GROUP BY T5.region_name ORDER BY COUNT(T2.competitor_id) DESC LIMIT 1", "index": 2458, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; the highest medal number refers to MAX(COUNT(medal_id <> 4));\nWhich region has the highest medal number?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['F', 'M']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Philippines', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale athletes refer to id where gender = 'F'; from the Philippines region_name = 'Philippines';\nHow many female athletes are from the Philippines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Philippines' AND T3.gender = 'F'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Philippines' AND T3.gender = 'F'", "index": 2459, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['F', 'M']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Philippines', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale athletes refer to id where gender = 'F'; from the Philippines region_name = 'Philippines';\nHow many female athletes are from the Philippines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Yao Ming', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name;\nWhich region is Yao Ming from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Yao Ming'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Yao Ming'", "index": 2460, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Yao Ming', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name;\nWhich region is Yao Ming from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Michael Fred Phelps, II', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAt what age join the Olympics refers to MIN(age);\nAt what age did Michael Fred Phelps, II join the Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.age FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Michael Fred Phelps, II' ORDER BY T2.age LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.age FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Michael Fred Phelps, II' ORDER BY T2.age LIMIT 1", "index": 2461, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Michael Fred Phelps, II', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAt what age join the Olympics refers to MIN(age);\nAt what age did Michael Fred Phelps, II join the Olympics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Clara Hughes', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many athletes are there in the region where Clara Hughes is from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(person_id) FROM person_region WHERE region_id = ( SELECT T1.region_id FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T2.full_name = 'Clara Hughes' )", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(person_id) FROM person_region WHERE region_id = ( SELECT T1.region_id FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T2.full_name = 'Clara Hughes' )", "index": 2462, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Clara Hughes', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many athletes are there in the region where Clara Hughes is from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity refers to city_name; 1992 Summer Olympic refers to games_name = '1992 Summer';\nWhich city was the 1992 Summer Olympic held?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1992 Summer'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1992 Summer'", "index": 2463, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity refers to city_name; 1992 Summer Olympic refers to games_name = '1992 Summer';\nWhich city was the 1992 Summer Olympic held?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Los Angeles', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLos Angeles refers to city_name = 'Lost Angeles'; the Olympic game refers to games_name; the most number of competitors refers to MAX(COUNT(games_name));\nAmong the Olympic games held in Los Angeles, what is the name of the Olympic game that has the most number of competitors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T4.city_name = 'Los Angeles' GROUP BY T1.id ORDER BY COUNT(T2.person_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T4.city_name = 'Los Angeles' GROUP BY T1.id ORDER BY COUNT(T2.person_id) DESC LIMIT 1", "index": 2464, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Los Angeles', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLos Angeles refers to city_name = 'Lost Angeles'; the Olympic game refers to games_name; the most number of competitors refers to MAX(COUNT(games_name));\nAmong the Olympic games held in Los Angeles, what is the name of the Olympic game that has the most number of competitors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of sport refers to sport_name\nState the name of sport id 19.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT sport_name FROM sport WHERE id = 19", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT sport_name FROM sport WHERE id = 19", "index": 2465, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of sport refers to sport_name\nState the name of sport id 19.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Rio de Janeiro', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRio de Janeiro refers to city_name = 'Rio de Janeiro';\nWhat is the id of Rio de Janeiro?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT id FROM city WHERE city_name = 'Rio de Janeiro'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT id FROM city WHERE city_name = 'Rio de Janeiro'", "index": 2466, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Rio de Janeiro', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRio de Janeiro refers to city_name = 'Rio de Janeiro';\nWhat is the id of Rio de Janeiro?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Vijay Singh Chauhan', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (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 Vijay Singh Chauhan's region 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.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Vijay Singh Chauhan'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Vijay Singh Chauhan'", "index": 2467, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Vijay Singh Chauhan', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (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 Vijay Singh Chauhan's region 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 competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1984 Summer', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 1984 Summer Olympic Games refer to games_name = '1984 Summer'; athletes more than 50 years old refer to person_id where age > 50;\nState the number of athletes in the 1984 Summer Olympic Games who were more than 50 years old.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1984 Summer' AND T2.age > 50", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1984 Summer' AND T2.age > 50", "index": 2468, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1984 Summer', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 1984 Summer Olympic Games refer to games_name = '1984 Summer'; athletes more than 50 years old refer to person_id where age > 50;\nState the number of athletes in the 1984 Summer Olympic Games who were more than 50 years old.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1968 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhost city refers to city_name; the 1968 Winter Olympic Games refer to games_name = '1968 Winter';\nTell the host city of the 1968 Winter Olympic Games.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1968 Winter'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1968 Winter'", "index": 2469, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1968 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhost city refers to city_name; the 1968 Winter Olympic Games refer to games_name = '1968 Winter';\nTell the host city of the 1968 Winter Olympic Games.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; the most athletes refer to MAX(COUNT(region_name));\nWhich region has the most athletes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1", "index": 2470, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; the most athletes refer to MAX(COUNT(region_name));\nWhich region has the most athletes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Paris', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSummer games refer to games_id where season = 'Summer'; Paris refers to city_name = 'Paris';\nHow many Summer games are there that were held in Paris?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Paris' AND T3.season = 'Summer'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T3.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Paris' AND T3.season = 'Summer'", "index": 2471, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Paris', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSummer games refer to games_id where season = 'Summer'; Paris refers to city_name = 'Paris';\nHow many Summer games are there that were held in Paris?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Los Angeles', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLos Angeles refers to city_name = 'Los Angeles';\nPlease list all game names that were held in Los Angeles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.games_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Los Angeles'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T3.games_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Los Angeles'", "index": 2472, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Los Angeles', 'Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLos Angeles refers to city_name = 'Los Angeles';\nPlease list all game names that were held in Los Angeles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich city refers to city_name; the most games refer to MAX(COUNT(city_name));\nWhich city hosted the most games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id GROUP BY T2.city_name ORDER BY COUNT(T2.city_name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id GROUP BY T2.city_name ORDER BY COUNT(T2.city_name) DESC LIMIT 1", "index": 2473, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich city refers to city_name; the most games refer to MAX(COUNT(city_name));\nWhich city hosted the most games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Lamusi', 'A Dijiang']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['2012 Summer', '1992 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2012 Summer refers to games_name = '2012 Summer';\nAt which age did A Lamusi participate in 2012 Summer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.age FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2012 Summer' AND T3.full_name = 'A Lamusi'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.age FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2012 Summer' AND T3.full_name = 'A Lamusi'", "index": 2474, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Lamusi', 'A Dijiang']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['2012 Summer', '1992 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2012 Summer refers to games_name = '2012 Summer';\nAt which age did A Lamusi participate in 2012 Summer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['2000 Summer', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2000 Summer refers to games_name = '2000 Summer'; age = 31\nHow many competitors were there who participated in 2000 Summer with age 31?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2000 Summer' AND T2.age = 31", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2000 Summer' AND T2.age = 31", "index": 2475, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['2000 Summer', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2000 Summer refers to games_name = '2000 Summer'; age = 31\nHow many competitors were there who participated in 2000 Summer with age 31?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1948 Summer', '1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale competitors refers to id where gender = 'M'; in 1948 Summer refers to games_name = '1948 Summer';\nHow many male competitors were there who participated in 1948 Summer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1948 Summer' AND T3.gender = 'M'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1948 Summer' AND T3.gender = 'M'", "index": 2476, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1948 Summer', '1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale competitors refers to id where gender = 'M'; in 1948 Summer refers to games_name = '1948 Summer';\nHow many male competitors were there who participated in 1948 Summer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1936 Summer', '1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompetitors' names refer to full_name; in 1936 Summer refers to games_name = '1936 Summer';\nPlease list all competitors' names who participated in 1936 Summer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.full_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1936 Summer'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T3.full_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1936 Summer'", "index": 2477, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1936 Summer', '1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompetitors' names refer to full_name; in 1936 Summer refers to games_name = '1936 Summer';\nPlease list all competitors' names who participated in 1936 Summer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['2014 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (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 youngest competitor refers to full_name where MIN(age); in 2014 Winter refers to games_name = '2014 Winter';\nWho is the youngest competitor that participated in 2014 Winter?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.full_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2014 Winter' ORDER BY T2.age LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T3.full_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2014 Winter' ORDER BY T2.age LIMIT 1", "index": 2478, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['2014 Winter', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (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 youngest competitor refers to full_name where MIN(age); in 2014 Winter refers to games_name = '2014 Winter';\nWho is the youngest competitor that participated in 2014 Winter?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1988 Winter', '1992 Summer', '2012 Summer']\n season text, -- example: ['Winter', 'Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(age) where games_name = '1988 Winter';\nWhat is the average age of competitors who participated in 1988 Winter?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1988 Winter'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1988 Winter'", "index": 2479, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1988 Winter', '1992 Summer', '2012 Summer']\n season text, -- example: ['Winter', 'Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(age) where games_name = '1988 Winter';\nWhat is the average age of competitors who participated in 1988 Winter?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['F', 'M']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(person_id where gender = 'F' and height > 170), COUNT(person_id)) as percentage where games_year = 1988;\nWhat is the percentage of female competitors whose heights are over 170 that participated in the game in 1988?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.gender = 'F' AND T3.height > 170 THEN 1 END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_year = 1988", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' AND T3.height > 170 THEN 1 END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_year = 1988", "index": 2480, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['F', 'M']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(person_id where gender = 'F' and height > 170), COUNT(person_id)) as percentage where games_year = 1988;\nWhat is the percentage of female competitors whose heights are over 170 that participated in the game in 1988?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Cross Country Skiing', 'Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Cross Country Skiing Men's 10/15 kilometres Pursuit\" refers to event_name = 'Cross Country Skiing Men''s 10/15 kilometres Pursuit';\nWhat is the sport name of \"Cross Country Skiing Men's 10/15 kilometres Pursuit\" event?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.sport_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T2.event_name LIKE 'Cross Country Skiing Men%s 10/15 kilometres Pursuit'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.sport_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T2.event_name LIKE 'Cross Country Skiing Men%s 10/15 kilometres Pursuit'", "index": 2481, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Cross Country Skiing', 'Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Cross Country Skiing Men's 10/15 kilometres Pursuit\" refers to event_name = 'Cross Country Skiing Men''s 10/15 kilometres Pursuit';\nWhat is the sport name of \"Cross Country Skiing Men's 10/15 kilometres Pursuit\" event?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Winter', 'Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\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(season = 'Winter' and age > 24), COUNT(person_id)) as percentage;\nWhat is the percentage of people whose age greater than 24 and participate in winter season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(CASE WHEN T2.age > 24 AND T1.season = 'Winter' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.games_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.age > 24 AND T1.season = 'Winter' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.games_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id", "index": 2482, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Winter', 'Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\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(season = 'Winter' and age > 24), COUNT(person_id)) as percentage;\nWhat is the percentage of people whose age greater than 24 and participate in winter season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMention the height of people who belong to region id 7.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.height FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T1.region_id = 7", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.height FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T1.region_id = 7", "index": 2483, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMention the height of people who belong to region id 7.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['London', 'Barcelona']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLondon refers to city_name = 'London';\nWhat are the id of the games held in London?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_id FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE T2.city_name = 'London'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.games_id FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE T2.city_name = 'London'", "index": 2484, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['London', 'Barcelona']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLondon refers to city_name = 'London';\nWhat are the id of the games held in London?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npeople who are below 30 refer to person_id where age < 30; the summer season refers to season = 'Summer';\nHow many people who are below 30 and participated in the summer season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' AND T2.age < 30", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' AND T2.age < 30", "index": 2485, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npeople who are below 30 refer to person_id where age < 30; the summer season refers to season = 'Summer';\nHow many people who are below 30 and participated in the summer season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Basketball', 'Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbasketball refers to sport_name = 'Basketball';\nState the event name of Basketball.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.event_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Basketball'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.event_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Basketball'", "index": 2486, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Basketball', 'Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbasketball refers to sport_name = 'Basketball';\nState the event name of Basketball.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; the majority of the athletes from refer to MAX(COUNT(region_name));\nWhich region is the majority of the athletes from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1", "index": 2487, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to region_name; the majority of the athletes from refer to MAX(COUNT(region_name));\nWhich region is the majority of the athletes from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Belgium', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBelgian men refer to gender = 'M' where region_name = 'Belgium';\nHow many Belgian men have competed in an Olympic Games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Belgium' AND T3.gender = 'M'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Belgium' AND T3.gender = 'M'", "index": 2488, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Belgium', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBelgian men refer to gender = 'M' where region_name = 'Belgium';\nHow many Belgian men have competed in an Olympic Games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBarcelona refers to city_name = 'Barcelona';\nHow many athletes took part in the Olympic games held in Barcelona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.person_id) FROM games_competitor AS T1 INNER JOIN games_city AS T2 ON T1.games_id = T2.games_id INNER JOIN city AS T3 ON T2.city_id = T3.id WHERE T3.city_name = 'Barcelona'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT COUNT(T1.person_id) FROM games_competitor AS T1 INNER JOIN games_city AS T2 ON T1.games_id = T2.games_id INNER JOIN city AS T3 ON T2.city_id = T3.id WHERE T3.city_name = 'Barcelona'", "index": 2489, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBarcelona refers to city_name = 'Barcelona';\nHow many athletes took part in the Olympic games held in Barcelona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBarcelona refers to city_name = 'Barcelona'; the most competitors refer to MAX(COUNT(games_name)); name of game refers to games_name;\nWhat is the name of the Olympic game with the most competitors held in Barcelona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T4.city_name = 'Barcelona' GROUP BY T1.id ORDER BY COUNT(T2.person_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T4.city_name = 'Barcelona' GROUP BY T1.id ORDER BY COUNT(T2.person_id) DESC LIMIT 1", "index": 2490, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBarcelona refers to city_name = 'Barcelona'; the most competitors refer to MAX(COUNT(games_name)); name of game refers to games_name;\nWhat is the name of the Olympic game with the most competitors held in Barcelona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Argentina', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to full_name; Argentina refers to region_name = 'Argentina';\nList the name of competitors from Argentina.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.full_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Argentina'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T3.full_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Argentina'", "index": 2491, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Argentina', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to full_name; Argentina refers to region_name = 'Argentina';\nList the name of competitors from Argentina.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Argentina', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['2012 Summer', '1992 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(age) where games_name = '2012 Summer' and region_name = 'Argentina';\nWhat is the average age of Argentina's athletes who participated in the Summer Olympics in 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person_region AS T3 ON T2.person_id = T3.person_id INNER JOIN noc_region AS T4 ON T3.region_id = T4.id WHERE T1.games_name = '2012 Summer' AND T4.region_name = 'Argentina'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person_region AS T3 ON T2.person_id = T3.person_id INNER JOIN noc_region AS T4 ON T3.region_id = T4.id WHERE T1.games_name = '2012 Summer' AND T4.region_name = 'Argentina'", "index": 2492, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Argentina', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['2012 Summer', '1992 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(age) where games_name = '2012 Summer' and region_name = 'Argentina';\nWhat is the average age of Argentina's athletes who participated in the Summer Olympics in 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Bronze', 'Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\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(competitor_id where medal_name = 'Bronze'), COUNT(competitor_id)) as percentage where event_name = 'Basketball Men''s Basketball';\nCalculate the percentage of bronze medals won by men's basketball players.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T4.medal_name = 'Bronze' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN event AS T3 ON T1.event_id = T3.id INNER JOIN medal AS T4 ON T1.medal_id = T4.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T4.medal_name = 'Bronze' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN event AS T3 ON T1.event_id = T3.id INNER JOIN medal AS T4 ON T1.medal_id = T4.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball'", "index": 2493, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Bronze', 'Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\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(competitor_id where medal_name = 'Bronze'), COUNT(competitor_id)) as percentage where event_name = 'Basketball Men''s Basketball';\nCalculate the percentage of bronze medals won by men's basketball players.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Georgios Abaris', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (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 games refers to games_name;\nList the name of the games that Georgios Abaris participated.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Georgios Abaris'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Georgios Abaris'", "index": 2494, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Georgios Abaris', 'A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (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 games refers to games_name;\nList the name of the games that Georgios Abaris participated.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNOC code refers to noc; competitors weighted 77 kg refer to person_id where weight = 77;\nWhat is the NOC code of the region of the competitors weighted 77 kg?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.noc FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.weight = 77", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.noc FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.weight = 77", "index": 2495, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNOC code refers to noc; competitors weighted 77 kg refer to person_id where weight = 77;\nWhat is the NOC code of the region of the competitors weighted 77 kg?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNOC code refers to noc; the heaviest refers to MAX(weight);\nGive the NOC code and region name of the heaviest competitor.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.noc, T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id ORDER BY T3.weight DESC LIMIT 1", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.noc, T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id ORDER BY T3.weight DESC LIMIT 1", "index": 2496, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNOC code refers to noc; the heaviest refers to MAX(weight);\nGive the NOC code and region name of the heaviest competitor.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Sohail Abbas', 'A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear refers to games_year;\nIn what year and season did Sohail Abbas compete?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.games_year, T1.season FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Sohail Abbas'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T1.games_year, T1.season FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Sohail Abbas'", "index": 2497, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['Sohail Abbas', 'A Dijiang', 'A Lamusi']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n season text, -- example: ['Summer', 'Winter']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear refers to games_year;\nIn what year and season did Sohail Abbas compete?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['2004 Summer', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin which city refers to city_name; the 2004 Summer refers to games_name = '2004 Summer';\nIn which city the 2004 Summer was held?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '2004 Summer'", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '2004 Summer'", "index": 2498, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n city_name text, -- example: ['Barcelona', 'London']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['2004 Summer', '1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n full_name text, -- example: ['A Dijiang', 'A Lamusi']\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n weight integer, -- example: [80, 60]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n event_name text, -- example: [\"Basketball Men's Basketball\", \"Judo Men's Extra-Lightweight\"]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n noc text, -- example: ['AFG', 'AHO']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n sport_name text, -- example: ['Aeronautics', 'Alpine Skiing']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n medal_name text, -- example: ['Gold', 'Silver']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin which city refers to city_name; the 2004 Summer refers to games_name = '2004 Summer';\nIn which city the 2004 Summer was held?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(height) where age BETWEEN 22 AND 28;\nCompute the average height of competitors whose age ranges from 22 to 28.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T1.height) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.age BETWEEN 22 AND 28", "style": "rule" }
{ "db_id": "olympics.sqlite", "gt_sql": "SELECT AVG(T1.height) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.age BETWEEN 22 AND 28", "index": 2499, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE event (\n id integer, -- example: [1, 2]\n sport_id integer, -- example: [9, 33]\n PRIMARY KEY (id),\n CONSTRAINT fk_event_sport_id FOREIGN KEY (sport_id) REFERENCES sport (id)\n);\n\nCREATE TABLE medal (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE sport (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE person_region (\n person_id integer, -- example: [1, 2]\n region_id integer, -- example: [42, 56]\n CONSTRAINT fk_person_region_person_id FOREIGN KEY (person_id) REFERENCES person (id),\n CONSTRAINT fk_person_region_region_id FOREIGN KEY (region_id) REFERENCES noc_region (id)\n);\n\nCREATE TABLE competitor_event (\n event_id integer, -- example: [1, 2]\n competitor_id integer, -- example: [1, 2]\n medal_id integer, -- example: [4, 1]\n CONSTRAINT fk_competitor_event_event_id FOREIGN KEY (event_id) REFERENCES event (id),\n CONSTRAINT fk_competitor_event_competitor_id FOREIGN KEY (competitor_id) REFERENCES games_competitor (id),\n CONSTRAINT fk_competitor_event_medal_id FOREIGN KEY (medal_id) REFERENCES medal (id)\n);\n\nCREATE TABLE person (\n id integer, -- example: [1, 2]\n gender text, -- example: ['M', 'F']\n height integer, -- example: [180, 170]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games (\n id integer, -- example: [1, 2]\n games_year integer, -- example: [1992, 2012]\n games_name text, -- example: ['1992 Summer', '2012 Summer']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_city (\n games_id integer, -- example: [1, 2]\n city_id integer, -- example: [1, 2]\n CONSTRAINT fk_games_city_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_city_city_id FOREIGN KEY (city_id) REFERENCES city (id)\n);\n\nCREATE TABLE city (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE noc_region (\n id integer, -- example: [1, 2]\n region_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE games_competitor (\n id integer, -- example: [1, 2]\n games_id integer, -- example: [1, 2]\n person_id integer, -- example: [1, 2]\n age integer, -- example: [24, 23]\n PRIMARY KEY (id),\n CONSTRAINT fk_games_competitor_games_id FOREIGN KEY (games_id) REFERENCES games (id),\n CONSTRAINT fk_games_competitor_person_id FOREIGN KEY (person_id) REFERENCES person (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAVG(height) where age BETWEEN 22 AND 28;\nCompute the average height of competitors whose age ranges from 22 to 28.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }