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 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 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 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 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 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 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:\nSUBTRACT(COUNT(weight > 70), COUNT(weight < 70)) where age < 24;\nAmong the competitors with age ranges 24 and below, calculate the difference between the number of competitors who weighed greater than 70 kg and competitors who weighted less than 70 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 COUNT(CASE WHEN T1.weight > 70 THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.weight < 70 THEN 1 ELSE NULL END) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.age < 24",
"style": "rule"
} | {
"db_id": "olympics.sqlite",
"gt_sql": "SELECT COUNT(CASE WHEN T1.weight > 70 THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.weight < 70 THEN 1 ELSE NULL END) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.age < 24",
"index": 2500,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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 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 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 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:\nSUBTRACT(COUNT(weight > 70), COUNT(weight < 70)) where age < 24;\nAmong the competitors with age ranges 24 and below, calculate the difference between the number of competitors who weighed greater than 70 kg and competitors who weighted less than 70 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 state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['ARECIBO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ARECIBO\" is the county; number of males refers to Sum(male_population)\nPlease list the numbers of males in all the residential areas in Arecibo county.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO'",
"index": 2501,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['ARECIBO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ARECIBO\" is the county; number of males refers to Sum(male_population)\nPlease list the numbers of males in all the residential areas in Arecibo county.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n black_population integer, -- example: [0, 663]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n disabled_workers integer, -- disable workers, example: [0, 885]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest average income per household refers to Max(avg_income_per_household)\nIn which county is the residential area with the highest average income per household located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' GROUP BY T2.county ORDER BY T1.avg_income_per_household DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' GROUP BY T2.county ORDER BY T1.avg_income_per_household DESC LIMIT 1",
"index": 2502,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n black_population integer, -- example: [0, 663]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n disabled_workers integer, -- disable workers, example: [0, 885]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest average income per household refers to Max(avg_income_per_household)\nIn which county is the residential area with the highest average income per household located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Daylight', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['Yes', 'No']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimplements daylight savings refers to daylight_savings = 'Yes'\nPlease list the names of all the counties with at least one residential area that implements daylight saving.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.daylight_savings = 'Yes'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.daylight_savings = 'Yes'",
"index": 2503,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Daylight', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['Yes', 'No']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimplements daylight savings refers to daylight_savings = 'Yes'\nPlease list the names of all the counties with at least one residential area that implements daylight saving.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['HUNTINGDON', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Huntingdon', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 30 employees refers to employee > 30; 'HUNTINGDON' is the county\nPlease list the zip_codes of all the residential areas in Huntingdon county with over 30 employees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'HUNTINGDON' AND T1.employees > 30",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'HUNTINGDON' AND T1.employees > 30",
"index": 2504,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['HUNTINGDON', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Huntingdon', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 30 employees refers to employee > 30; 'HUNTINGDON' is the county\nPlease list the zip_codes of all the residential areas in Huntingdon county with over 30 employees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Eastern', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Internal Revenue', 'Eastern', 'Time', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Eastern', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Internal Revenue Service\" is the bad_alias; in Eastern time zone refers to time_zone = 'Eastern'\nAmong the residential areas with the bad alias \"Internal Revenue Service\", how many of them are in the Eastern time zone?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T2.bad_alias = 'Internal Revenue Service' AND T1.time_zone = 'Eastern'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T2.bad_alias = 'Internal Revenue Service' AND T1.time_zone = 'Eastern'",
"index": 2505,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Eastern', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Internal Revenue', 'Eastern', 'Time', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Eastern', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Internal Revenue Service\" is the bad_alias; in Eastern time zone refers to time_zone = 'Eastern'\nAmong the residential areas with the bad alias \"Internal Revenue Service\", how many of them are in the Eastern time zone?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n median_age real, -- example: [0.0, 35.9]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n retired_workers integer, -- example: [0, 2940]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['House', 'Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest average house value refers to Max(avg_house_value)\nWhat is the bad alias of the residential area with the highest average house value?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bad_alias FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.bad_alias FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1",
"index": 2506,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n median_age real, -- example: [0.0, 35.9]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n retired_workers integer, -- example: [0, 2940]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['House', 'Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest average house value refers to Max(avg_house_value)\nWhat is the bad alias of the residential area with the highest average house value?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['NEW YORK', 'YORK', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Post Office', 'Unique Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['New York', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['NY', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['New York', 'Type', 'York', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['NY', 'AA', 'AE']\n name text, -- example: ['New York', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" refers to state = 'NY' and name = 'New York'; 'Post Office' is the type\nHow many post offices are there in New York?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'NY' AND T2.type = 'Post Office'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'NY' AND T2.type = 'Post Office'",
"index": 2507,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['NEW YORK', 'YORK', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Post Office', 'Unique Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['New York', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['NY', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['New York', 'Type', 'York', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['NY', 'AA', 'AE']\n name text, -- example: ['New York', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" refers to state = 'NY' and name = 'New York'; 'Post Office' is the type\nHow many post offices are there in New York?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['California', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['CA', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['California', 'Many', 'Post', 'Holtsville', 'Adjuntas']\n state text, -- example: ['CA', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Community Post Office ', 'Post Office', 'Unique Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['CA', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['CA', 'AA', 'AE']\n name text, -- example: ['California', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['California', 'Many', 'Post', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin California refers to name = 'California' and state = 'CA'; 'Community Post Office' is the Type\nIn California, how many delivery receptacles are there in the community post office that has the highest number of delivery receptacles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'CA' AND T2.type LIKE '%Community Post Office%' AND T1.name = 'California' AND T2.state = 'CA'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(*) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'CA' AND T2.type LIKE '%Community Post Office%' AND T1.name = 'California' AND T2.state = 'CA'",
"index": 2508,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['California', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['CA', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['California', 'Many', 'Post', 'Holtsville', 'Adjuntas']\n state text, -- example: ['CA', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Community Post Office ', 'Post Office', 'Unique Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['CA', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['CA', 'AA', 'AE']\n name text, -- example: ['California', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['California', 'Many', 'Post', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin California refers to name = 'California' and state = 'CA'; 'Community Post Office' is the Type\nIn California, how many delivery receptacles are there in the community post office that has the highest number of delivery receptacles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['PA', 'NJ', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Allentown-Bethlehem-Easton, PA-NJ', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Bethlehem', 'Allentown', 'Easton', 'Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['PA', 'NJ', 'AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Bethlehem', 'Allentown', 'Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['PA', 'NJ', 'NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Bethlehem', 'Allentown', 'Easton', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['PA', 'NJ', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Allentown-Bethlehem-Easton, PA-NJ\" is the CBSA_name; most populated city refers to Max(population_2020); difference = Subtract (population_2020, population_2011)\nWhat is the difference in the most populated city of Allentown-Bethlehem-Easton, PA-NJ in 2020 against its population in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.population_2020 - T1.population_2010 AS result_data FROM zip_data AS T1 INNER JOIN CBSA AS T2 ON T1.CBSA = T2.CBSA WHERE T2.CBSA_name = 'Allentown-Bethlehem-Easton, PA-NJ' ORDER BY T1.population_2020 DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.population_2020 - T1.population_2010 AS result_data FROM zip_data AS T1 INNER JOIN CBSA AS T2 ON T1.CBSA = T2.CBSA WHERE T2.CBSA_name = 'Allentown-Bethlehem-Easton, PA-NJ' ORDER BY T1.population_2020 DESC LIMIT 1",
"index": 2509,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['PA', 'NJ', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Allentown-Bethlehem-Easton, PA-NJ', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Bethlehem', 'Allentown', 'Easton', 'Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['PA', 'NJ', 'AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Bethlehem', 'Allentown', 'Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['PA', 'NJ', 'NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Bethlehem', 'Allentown', 'Easton', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['PA', 'NJ', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Allentown-Bethlehem-Easton, PA-NJ\" is the CBSA_name; most populated city refers to Max(population_2020); difference = Subtract (population_2020, population_2011)\nWhat is the difference in the most populated city of Allentown-Bethlehem-Easton, PA-NJ in 2020 against its population in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['New Castle', 'Delaware', 'Castle', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['New Castle', 'Delaware', 'Castle', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Delaware', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Delaware', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Castle', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['NEW CASTLE', 'DELAWARE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"NEW CASTLE\" is the county; 'Delaware' is the name of state\nList all the zip codes in the county of New Castle in Delaware.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T2.county = 'NEW CASTLE' AND T1.name = 'Delaware'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T2.county = 'NEW CASTLE' AND T1.name = 'Delaware'",
"index": 2510,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['New Castle', 'Delaware', 'Castle', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['New Castle', 'Delaware', 'Castle', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Delaware', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Delaware', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Castle', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['NEW CASTLE', 'DELAWARE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"NEW CASTLE\" is the county; 'Delaware' is the name of state\nList all the zip codes in the county of New Castle in Delaware.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Zero', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Murkowski', 'Young', 'Begich']\n last_name text, -- example: ['Lisa', 'Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nzero employee refers to employees = 0\nIn the state where Lisa Murkowski is the representative, how many cities have zero employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.city) FROM congress AS T1 INNER JOIN state AS T2 ON T1.abbreviation = T2.abbreviation INNER JOIN zip_data AS T3 ON T2.abbreviation = T3.state WHERE T1.first_name = 'Murkowski' AND T1.last_name = 'Lisa' AND T3.employees = 0",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T3.city) FROM congress AS T1 INNER JOIN state AS T2 ON T1.abbreviation = T2.abbreviation INNER JOIN zip_data AS T3 ON T2.abbreviation = T3.state WHERE T1.first_name = 'Murkowski' AND T1.last_name = 'Lisa' AND T3.employees = 0",
"index": 2511,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Zero', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Murkowski', 'Young', 'Begich']\n last_name text, -- example: ['Lisa', 'Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nzero employee refers to employees = 0\nIn the state where Lisa Murkowski is the representative, how many cities have zero employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity with highest asian population refers to Max(Sum(asian_population)); full name refers to first_name, last_name\nWhat are the top 3 states with the highest Asian population? List the full names of all the representatives in the said states.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT t.state, T1.first_name, T1.last_name FROM zip_data AS T INNER JOIN congress AS T1 ON t.state = T1.abbreviation GROUP BY t.state ORDER BY SUM(t.asian_population) DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT t.state, T1.first_name, T1.last_name FROM zip_data AS T INNER JOIN congress AS T1 ON t.state = T1.abbreviation GROUP BY t.state ORDER BY SUM(t.asian_population) DESC LIMIT 3",
"index": 2512,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity with highest asian population refers to Max(Sum(asian_population)); full name refers to first_name, last_name\nWhat are the top 3 states with the highest Asian population? List the full names of all the representatives in the said states.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['New Haven', 'Haven', 'S Haven', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['NEW HAVEN', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['New Haven', 'Haven', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"NEW HAVEN\" is the county; male refers to male_population\nHow many males are there in New Haven County's residential areas?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'NEW HAVEN'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'NEW HAVEN'",
"index": 2513,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['New Haven', 'Haven', 'S Haven', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['NEW HAVEN', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['New Haven', 'Haven', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"NEW HAVEN\" is the county; male refers to male_population\nHow many males are there in New Haven County's residential areas?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n hawaiian_population integer, -- example: [0, 10]\n male_median_age real, -- example: [0.0, 34.5]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinates refers to latitude, longitude; latitude = '18.090875; longitude = '-66.867756'\nShow the alias for the county at coordinate (18.090875, -66.867756).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.alias FROM zip_data AS T1 INNER JOIN alias AS T2 ON T1.zip_code = T2.zip_code WHERE T1.latitude = 18.090875 AND T1.longitude = -66.867756",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.alias FROM zip_data AS T1 INNER JOIN alias AS T2 ON T1.zip_code = T2.zip_code WHERE T1.latitude = 18.090875 AND T1.longitude = -66.867756",
"index": 2514,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n hawaiian_population integer, -- example: [0, 10]\n male_median_age real, -- example: [0.0, 34.5]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinates refers to latitude, longitude; latitude = '18.090875; longitude = '-66.867756'\nShow the alias for the county at coordinate (18.090875, -66.867756).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation coordinate refers to (latitude, longitude)\nGive the location coordinates of the city with area code 636.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 636",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 636",
"index": 2515,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation coordinate refers to (latitude, longitude)\nGive the location coordinates of the city with area code 636.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n region text, -- example: ['Northeast', 'South']\n black_population integer, -- example: [0, 663]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich state is area code 878 in? Give the name of the state.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 878",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 878",
"index": 2516,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n region text, -- example: ['Northeast', 'South']\n black_population integer, -- example: [0, 663]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich state is area code 878 in? Give the name of the state.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Virginia', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Virginia', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Virginia', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Virginia', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Virginia', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Virginia', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Virginia\" is the state\nHow many counties are there in Virginia State?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virginia'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virginia'",
"index": 2517,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Virginia', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Virginia', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Virginia', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Virginia', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Virginia', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Virginia', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Virginia\" is the state\nHow many counties are there in Virginia State?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n employees integer, -- example: [0, 9127]\n retired_workers integer, -- example: [0, 2940]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposition refers to latitude, longitude\nGive the name and the position of the cbsa officer from the area with the zip code 45503.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CBSA_name, T2.latitude, T2.longitude FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.zip_code = 45503 GROUP BY T1.CBSA_name, T2.latitude, T2.longitude",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.CBSA_name, T2.latitude, T2.longitude FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.zip_code = 45503 GROUP BY T1.CBSA_name, T2.latitude, T2.longitude",
"index": 2518,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n employees integer, -- example: [0, 9127]\n retired_workers integer, -- example: [0, 2940]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposition refers to latitude, longitude\nGive the name and the position of the cbsa officer from the area with the zip code 45503.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Windham', 'Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['WINDHAM', 'DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n retired_workers integer, -- example: [0, 2940]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Windham', 'Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage male median age refers to Divide (Sum(male_median_age), Count(county)); 'WINDHAM' is the county\nCalculate the average male median age of all the residential areas in Windham county.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.male_median_age) / COUNT(T2.median_age) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'WINDHAM'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT SUM(T2.male_median_age) / COUNT(T2.median_age) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'WINDHAM'",
"index": 2519,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Windham', 'Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['WINDHAM', 'DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n retired_workers integer, -- example: [0, 2940]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Windham', 'Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage male median age refers to Divide (Sum(male_median_age), Count(county)); 'WINDHAM' is the county\nCalculate the average male median age of all the residential areas in Windham county.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AL', 'AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AL', 'AK']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Geneva', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Geneva', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Geneva', 'Holtsville', 'Adjuntas']\n state text, -- example: ['AL', 'NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['GENEVA', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['AL', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Geneva\" is the city; 'AL' is the state\nName the bad alias of Geneva, AL.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Geneva' AND T2.state = 'AL'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Geneva' AND T2.state = 'AL'",
"index": 2520,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AL', 'AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AL', 'AK']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Geneva', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Geneva', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Geneva', 'Holtsville', 'Adjuntas']\n state text, -- example: ['AL', 'NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n latitude real, -- example: [40.817923, 40.788827]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['GENEVA', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['AL', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Geneva\" is the city; 'AL' is the state\nName the bad alias of Geneva, AL.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Hills', 'Hill', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Druid Hills', 'Hills', 'Hill', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['HILL', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Hills', 'Hill', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n american_indian_population integer, -- example: [0, 113]\n male_population integer, -- example: [0, 9078]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Druid Hills\" is the bad_alias\nName the county that has the bad alias of Druid Hills.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.county FROM avoid AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Druid Hills'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.county FROM avoid AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Druid Hills'",
"index": 2521,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Hills', 'Hill', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Druid Hills', 'Hills', 'Hill', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['HILL', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Hills', 'Hill', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n american_indian_population integer, -- example: [0, 113]\n male_population integer, -- example: [0, 9078]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Druid Hills\" is the bad_alias\nName the county that has the bad alias of Druid Hills.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Montana', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Phillips', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n hawaiian_population integer, -- example: [0, 10]\n male_median_age real, -- example: [0.0, 34.5]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['PHILLIPS', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Phillips', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Montana', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"PHILLIPS\" is the county; 'Montana' is the name of state\nWhat is the area code of Phillips county in Montana?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.area_code FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN state AS T3 ON T2.state = T3.abbreviation WHERE T2.county = 'PHILLIPS' AND T3.name = 'Montana'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T1.area_code FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN state AS T3 ON T2.state = T3.abbreviation WHERE T2.county = 'PHILLIPS' AND T3.name = 'Montana'",
"index": 2522,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Montana', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Phillips', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n hawaiian_population integer, -- example: [0, 10]\n male_median_age real, -- example: [0.0, 34.5]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['PHILLIPS', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Phillips', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Montana', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"PHILLIPS\" is the county; 'Montana' is the name of state\nWhat is the area code of Phillips county in Montana?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Illinois', 'Alabama', 'Alaska']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Illinois', 'Alabama', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n residential_mailboxes integer, -- example: [0, 4133]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Alabama\" and \"Illinois\" are both state; Ratio = Divide (Count(state = 'Alabama'), Count(state = 'Illinois'))\nCalculate the ratio between the number of representatives in Alabama and the number of representatives in Illinois.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 state = 'Alabama' THEN cognress_rep_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN state = 'Illinois' THEN cognress_rep_id ELSE NULL END) FROM congress",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN state = 'Alabama' THEN cognress_rep_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN state = 'Illinois' THEN cognress_rep_id ELSE NULL END) FROM congress",
"index": 2523,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Illinois', 'Alabama', 'Alaska']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Illinois', 'Alabama', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n residential_mailboxes integer, -- example: [0, 4133]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Alabama\" and \"Illinois\" are both state; Ratio = Divide (Count(state = 'Alabama'), Count(state = 'Illinois'))\nCalculate the ratio between the number of representatives in Alabama and the number of representatives in Illinois.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage of 2020 population in each zip code refers to Divide (Sum(population_2020), Count(zip_code))\nCalculate the average of 2020's population in each zip code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(population_2020) AS REAL) / COUNT(zip_code) FROM zip_data",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT CAST(SUM(population_2020) AS REAL) / COUNT(zip_code) FROM zip_data",
"index": 2524,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage of 2020 population in each zip code refers to Divide (Sum(population_2020), Count(zip_code))\nCalculate the average of 2020's population in each zip code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['NH', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Berlin', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Berlin', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NH', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NH', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Berlin, NH', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['NH', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Berlin', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Berlin, NH\" is the CBSA_name\nState the male population for all zip code which were under the Berlin, NH CBSA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.male_population FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Berlin, NH' GROUP BY T2.male_population",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.male_population FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Berlin, NH' GROUP BY T2.male_population",
"index": 2525,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['NH', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Berlin', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Berlin', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NH', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NH', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Berlin, NH', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['NH', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Berlin', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Berlin, NH\" is the CBSA_name\nState the male population for all zip code which were under the Berlin, NH CBSA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_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 state for area code of 787?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787",
"index": 2526,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_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 state for area code of 787?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['ARECIBO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_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\"Arecibo\" is the city\nState the county for Arecibo City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Arecibo'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Arecibo'",
"index": 2527,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Arecibo', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['ARECIBO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_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\"Arecibo\" is the city\nState the county for Arecibo City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['VT', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Barre, VT', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Barre', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['VT', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['VT', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n median_age real, -- example: [0.0, 35.9]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['VT', 'NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Barr', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['VT', 'AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['VT', 'AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Barre, VT\" is the CBSA_name\nHow many zip codes are under Barre, VT?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Barre, VT'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.zip_code) FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Barre, VT'",
"index": 2528,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['VT', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Barre, VT', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Barre', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['VT', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['VT', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n median_age real, -- example: [0.0, 35.9]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['VT', 'NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Barr', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['VT', 'AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['VT', 'AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Barre, VT\" is the CBSA_name\nHow many zip codes are under Barre, VT?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Griffin', 'Young', 'Begich']\n last_name text, -- example: ['Tim', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['District', 'Griffin', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Griffin', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Griffin', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference = Subtract (population_2020, population_2010)\nCalculate the difference between the 2020 population and the 2010 population for the districts represented by Griffin Tim.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.population_2020 - T1.population_2010 FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Griffin' AND T3.last_name = 'Tim'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.population_2020 - T1.population_2010 FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Griffin' AND T3.last_name = 'Tim'",
"index": 2529,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Griffin', 'Young', 'Begich']\n last_name text, -- example: ['Tim', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['District', 'Griffin', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Griffin', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Griffin', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference = Subtract (population_2020, population_2010)\nCalculate the difference between the 2020 population and the 2010 population for the districts represented by Griffin Tim.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Atmore, AL', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AL', 'AK']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['AL', 'NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n asian_population integer, -- example: [0, 7]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n parents_and_widowed integer, -- example: [0, 155]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['AL', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Atmore', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AL', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Atmore, AL\" is CBSA_name; percentage = Divide(asian_population, population_2020) * 100\nBased on the population in 2020, calculate the percentage for the population of Asian in the zip code where the CBSA was Atmore, AL.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T2.asian_population AS REAL) * 100 / T2.population_2010 FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Atmore, AL'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT CAST(T2.asian_population AS REAL) * 100 / T2.population_2010 FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Atmore, AL'",
"index": 2530,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Atmore, AL', 'Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AL', 'AK']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['AL', 'NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n asian_population integer, -- example: [0, 7]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n parents_and_widowed integer, -- example: [0, 155]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['AL', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Atmore', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AL', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Atmore, AL\" is CBSA_name; percentage = Divide(asian_population, population_2020) * 100\nBased on the population in 2020, calculate the percentage for the population of Asian in the zip code where the CBSA was Atmore, AL.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nelevation of 1039 refers to elevation = 1039\nGive the name of the country and state of the city with elevation of 1039.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.name, T2.state FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T3.elevation = 1039",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T1.name, T2.state FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T3.elevation = 1039",
"index": 2531,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nelevation of 1039 refers to elevation = 1039\nGive the name of the country and state of the city with elevation of 1039.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['White', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['White', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['WHITE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the area code of the city with the white population ranging between 1700 to 2000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.white_population BETWEEN 1700 AND 2000",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.white_population BETWEEN 1700 AND 2000",
"index": 2532,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['White', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['White', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['WHITE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the area code of the city with the white population ranging between 1700 to 2000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Leeds', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Leeds', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Leeds', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n population_2010 integer, -- example: [0, 18570]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n other_population integer, -- example: [0, 558]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n annual_payroll integer, -- example: [0, 376492000]\n land_area real, -- example: [0.0, 64.348]\n parents_and_widowed integer, -- example: [0, 155]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the Asian population in the city with the alias Leeds?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.asian_population) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Leeds'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT SUM(T2.asian_population) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Leeds'",
"index": 2533,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Leeds', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Leeds', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Leeds', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n population_2010 integer, -- example: [0, 18570]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n other_population integer, -- example: [0, 558]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n annual_payroll integer, -- example: [0, 376492000]\n land_area real, -- example: [0.0, 64.348]\n parents_and_widowed integer, -- example: [0, 155]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the Asian population in the city with the alias Leeds?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Savoy', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Savoy', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n elevation integer, -- example: [25, 0]\n female_population integer, -- example: [0, 9492]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSavoy is the city;\nList down the area code and country of the city named Savoy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.area_code, T2.county FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN zip_data AS T3 ON T1.zip_code = T3.zip_code WHERE T3.city = 'Savoy'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.area_code, T2.county FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN zip_data AS T3 ON T1.zip_code = T3.zip_code WHERE T3.city = 'Savoy'",
"index": 2534,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Savoy', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Savoy', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n elevation integer, -- example: [25, 0]\n female_population integer, -- example: [0, 9492]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSavoy is the city;\nList down the area code and country of the city named Savoy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n region text, -- example: ['Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n persons_per_household real, -- example: [0.0, 2.84]\n hispanic_population integer, -- example: [0, 18486]\n male_median_age real, -- example: [0.0, 34.5]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith 0 population in 2010 refers to population_2010 = 0;\nWhat are the alias of the cities with 0 population in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2010 = 0",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2010 = 0",
"index": 2535,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n region text, -- example: ['Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n persons_per_household real, -- example: [0.0, 2.84]\n hispanic_population integer, -- example: [0, 18486]\n male_median_age real, -- example: [0.0, 34.5]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith 0 population in 2010 refers to population_2010 = 0;\nWhat are the alias of the cities with 0 population in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Post', 'Only', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Post', 'Only', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['P.O. Box Only', 'Post Office', 'Unique Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(COUNT(type = 'P.O. Box Only'), COUNT(type = 'Post Office')) where area_code = 787;\nWhat is the difference in the number of cities with P.O. box only and cities with Post Office among the cities with area code 787?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(CASE WHEN T2.type = 'P.O. Box Only' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.type = 'Post Office' THEN 1 ELSE NULL END) AS DIFFERENCE FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(CASE WHEN T2.type = 'P.O. Box Only' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.type = 'Post Office' THEN 1 ELSE NULL END) AS DIFFERENCE FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787",
"index": 2536,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Post', 'Only', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Post', 'Only', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['P.O. Box Only', 'Post Office', 'Unique Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(COUNT(type = 'P.O. Box Only'), COUNT(type = 'Post Office')) where area_code = 787;\nWhat is the difference in the number of cities with P.O. box only and cities with Post Office among the cities with area code 787?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the city where zip code 19019 is located and the alias of that city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.city, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 19019",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.city, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 19019",
"index": 2537,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the city where zip code 19019 is located and the alias of that city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['CAMUY', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Camuy', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n county_fips integer, -- country fips, example: [103, 1]\n american_indian_population integer, -- example: [0, 113]\n female_population integer, -- example: [0, 9492]\n total_delivery_receptacles integer, -- example: [1, 0]\n employees integer, -- example: [0, 9127]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Camuy', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; Camuy is the city;\nList the bad alias of the postal point located in Camuy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Camuy'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Camuy'",
"index": 2538,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['CAMUY', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Camuy', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n county_fips integer, -- country fips, example: [103, 1]\n american_indian_population integer, -- example: [0, 113]\n female_population integer, -- example: [0, 9492]\n total_delivery_receptacles integer, -- example: [1, 0]\n employees integer, -- example: [0, 9127]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Camuy', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; Camuy is the city;\nList the bad alias of the postal point located in Camuy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Midwest', 'Points', 'Point', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n region text, -- example: ['Midwest', 'Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Daylight', 'Region', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Midwest', 'Points', 'Point', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Illinois', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Illinois', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; the daylight savings areas refer to daylight_savings = 'Yes'; Illinois is the name of the state, in which name = 'Illinois';\nAmong the daylight savings areas in the Midwest region, how many postal points are there in Illinois?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Illinois' AND T2.daylight_savings = 'Yes' AND T2.region = 'Midwest'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Illinois' AND T2.daylight_savings = 'Yes' AND T2.region = 'Midwest'",
"index": 2539,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Midwest', 'Points', 'Point', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n region text, -- example: ['Midwest', 'Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Daylight', 'Region', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Midwest', 'Points', 'Point', 'Many', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Illinois', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Illinois', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; the daylight savings areas refer to daylight_savings = 'Yes'; Illinois is the name of the state, in which name = 'Illinois';\nAmong the daylight savings areas in the Midwest region, how many postal points are there in Illinois?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Virgin Islands', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Virgin Islands', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['ISLAND', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Virgin Islands refer to state where name = 'Virgin Islands';\nProvide the countries and the zip codes in the Virgin Islands.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.county, T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virgin Islands'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.county, T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virgin Islands'",
"index": 2540,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Virgin Islands', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Virgin Islands', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['ISLAND', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Virgin Islands refer to state where name = 'Virgin Islands';\nProvide the countries and the zip codes in the Virgin Islands.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Greeneville', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hawaiian_population integer, -- example: [0, 10]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Greeneville', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGreeneville is the city;\nProvide the zip codes and the alias of Greeneville.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Greeneville'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.zip_code, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Greeneville'",
"index": 2541,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Greeneville', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hawaiian_population integer, -- example: [0, 10]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Greeneville', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGreeneville is the city;\nProvide the zip codes and the alias of Greeneville.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Oxford', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Oxford', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['OXFORD', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Oxford', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCBSA officers refer to CBSA_name; postal point refers to zip_code; Oxford is the city;\nProvide the zip codes and CBSA officers of the postal point in Oxford.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code, T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'Oxford'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.zip_code, T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'Oxford'",
"index": 2542,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Oxford', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Oxford', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['OXFORD', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Oxford', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCBSA officers refer to CBSA_name; postal point refers to zip_code; Oxford is the city;\nProvide the zip codes and CBSA officers of the postal point in Oxford.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Congress', 'Reader', 'Points', 'Organ', 'Point', 'Holtsville']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['Readers Digest', 'I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n other_population integer, -- example: [0, 558]\n median_age real, -- example: [0.0, 35.9]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n disabled_workers integer, -- disable workers, example: [0, 885]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Readers Digest', 'Reader', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepresentative's full names refer to first_name, last_name; postal points affiliated with Readers Digest refer to zip_code where organization = 'Readers Digest';\nProvide the zip codes and the congress representatives' names of the postal points which are affiliated with Readers Digest.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code, T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.organization = 'Readers Digest'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.zip_code, T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.organization = 'Readers Digest'",
"index": 2543,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Congress', 'Reader', 'Points', 'Organ', 'Point', 'Holtsville']\n state text, -- example: ['NY', 'PR']\n organization text, -- example: ['Readers Digest', 'I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n other_population integer, -- example: [0, 558]\n median_age real, -- example: [0.0, 35.9]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n disabled_workers integer, -- disable workers, example: [0, 885]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Readers Digest', 'Reader', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepresentative's full names refer to first_name, last_name; postal points affiliated with Readers Digest refer to zip_code where organization = 'Readers Digest';\nProvide the zip codes and the congress representatives' names of the postal points which are affiliated with Readers Digest.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n county_fips integer, -- country fips, example: [103, 1]\n avg_house_value integer, -- average house value, example: [0, 86200]\n hispanic_population integer, -- example: [0, 18486]\n male_population integer, -- example: [0, 9078]\n male_median_age real, -- example: [0.0, 34.5]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most bad aliases refer to MAX(COUNT(bad_alias));\nWhich city has the most bad aliases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.city FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T1.bad_alias ORDER BY COUNT(T1.zip_code) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.city FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T1.bad_alias ORDER BY COUNT(T1.zip_code) DESC LIMIT 1",
"index": 2544,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n county_fips integer, -- country fips, example: [103, 1]\n avg_house_value integer, -- average house value, example: [0, 86200]\n hispanic_population integer, -- example: [0, 18486]\n male_population integer, -- example: [0, 9078]\n male_median_age real, -- example: [0.0, 34.5]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most bad aliases refer to MAX(COUNT(bad_alias));\nWhich city has the most bad aliases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['House', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_house_value integer, -- average house value, example: [0, 86200]\n black_population integer, -- example: [0, 663]\n other_population integer, -- example: [0, 558]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest average house value refers to avg_house_value;\nWhat is the name of the CBSA of the city with the highest average house value?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1",
"index": 2545,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['House', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n avg_house_value integer, -- average house value, example: [0, 86200]\n black_population integer, -- example: [0, 663]\n other_population integer, -- example: [0, 558]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest average house value refers to avg_house_value;\nWhat is the name of the CBSA of the city with the highest average house value?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Micro', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Micro', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmicro CBSA refers to CBSA_type = 'Micro';\nList all the cities with micro CBSA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.city FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_type = 'Micro'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.city FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_type = 'Micro'",
"index": 2546,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Micro', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Micro', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmicro CBSA refers to CBSA_type = 'Micro';\nList all the cities with micro CBSA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['FL-10', 'AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['FL-10', 'NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['District', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the number of households in the \"FL-10\" district?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T2.district = 'FL-10' THEN 1 ELSE 0 END) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.district = 'FL-10' THEN 1 ELSE 0 END) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code",
"index": 2547,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['FL-10', 'AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['FL-10', 'NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['District', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the number of households in the \"FL-10\" district?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabove-average female population refers to female_population > DIVIDE(SUM(female_population), COUNT(state));\nWhat are the states with an above-average female population?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.state FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T2.female_population > ( SELECT AVG(female_population) FROM zip_data )",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT DISTINCT T2.state FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T2.female_population > ( SELECT AVG(female_population) FROM zip_data )",
"index": 2548,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabove-average female population refers to female_population > DIVIDE(SUM(female_population), COUNT(state));\nWhat are the states with an above-average female population?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['CORYELL', 'DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\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(households where county = 'CORYELL'), SUM(households)) as percentage;\nWhat percentage of households are in \"Coroyell\" out of its state?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.county = 'CORYELL' THEN T2.households ELSE 0 END) AS REAL) * 100 / SUM(T2.households) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.county = 'CORYELL' THEN T2.households ELSE 0 END) AS REAL) * 100 / SUM(T2.households) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code",
"index": 2549,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['CORYELL', 'DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\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(households where county = 'CORYELL'), SUM(households)) as percentage;\nWhat percentage of households are in \"Coroyell\" out of its state?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['CABO ROJO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Cabo Rojo', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Cabo Rojo', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n land_area real, -- example: [0.0, 64.348]\n total_beneficiaries integer, -- example: [0, 5135]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the CBSA officer refers to CBSA_name; position of the CBSA officer refers to CBSA_type;\nWhat is the name and the position of the CBSA officer in the city of Cabo Rojo?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CBSA_name, T1.CBSA_type FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'Cabo Rojo' GROUP BY T1.CBSA_name, T1.CBSA_type",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.CBSA_name, T1.CBSA_type FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'Cabo Rojo' GROUP BY T1.CBSA_name, T1.CBSA_type",
"index": 2550,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['CABO ROJO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Cabo Rojo', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Cabo Rojo', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n land_area real, -- example: [0.0, 64.348]\n total_beneficiaries integer, -- example: [0, 5135]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the CBSA officer refers to CBSA_name; position of the CBSA officer refers to CBSA_type;\nWhat is the name and the position of the CBSA officer in the city of Cabo Rojo?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Las Marias', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Maria', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['LA', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Las Marias', 'Holtsville', 'Adjuntas']\n state text, -- example: ['LA', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['LAS MARIAS', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['LA', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicate the country name of the city Las Marias.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Las Marias'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Las Marias'",
"index": 2551,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Las Marias', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Maria', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['LA', 'AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Las Marias', 'Holtsville', 'Adjuntas']\n state text, -- example: ['LA', 'NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['LAS MARIAS', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['LA', 'AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicate the country name of the city Las Marias.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Pierluisi', 'Young', 'Begich']\n last_name text, -- example: ['Pedro', 'Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Pedro', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_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 cities does congressman Pierluisi Pedro represent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.city) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Pierluisi' AND T3.last_name = 'Pedro'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.city) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Pierluisi' AND T3.last_name = 'Pedro'",
"index": 2552,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Pierluisi', 'Young', 'Begich']\n last_name text, -- example: ['Pedro', 'Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Pedro', 'Many', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n employees integer, -- example: [0, 9127]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_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 cities does congressman Pierluisi Pedro represent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Aguadilla', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Aguadilla', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['AGUADILLA', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the names of bad aliases in the city of Aguadilla.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Aguadilla'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Aguadilla'",
"index": 2553,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Aguadilla', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Aguadilla', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['AGUADILLA', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the names of bad aliases in the city of Aguadilla.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most bad aliases refer to MAX(COUNT(bad_alias));\nWhich state has the most bad aliases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.state ORDER BY COUNT(T1.bad_alias) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.state ORDER BY COUNT(T1.bad_alias) DESC LIMIT 1",
"index": 2554,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most bad aliases refer to MAX(COUNT(bad_alias));\nWhich state has the most bad aliases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Aguadilla', 'Aguada', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n hispanic_population integer, -- example: [0, 18486]\n female_median_age real, -- example: [0.0, 37.1]\n parents_and_widowed integer, -- example: [0, 155]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Aguadilla', 'Aguada', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['AGUADILLA', 'AGUADA', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(COUNT(bad_alias where city = 'Aguada'), COUNT(bad_alias where city = 'Aguadilla'));\nWhat is the difference in the number of bad alias between Aguada city and Aguadilla city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(CASE WHEN T2.city = 'Aguada' THEN T1.bad_alias ELSE NULL END) - COUNT(CASE WHEN T2.city = 'Aguadilla' THEN T1.bad_alias ELSE NULL END) AS DIFFERENCE FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(CASE WHEN T2.city = 'Aguada' THEN T1.bad_alias ELSE NULL END) - COUNT(CASE WHEN T2.city = 'Aguadilla' THEN T1.bad_alias ELSE NULL END) AS DIFFERENCE FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code",
"index": 2555,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Aguadilla', 'Aguada', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n hispanic_population integer, -- example: [0, 18486]\n female_median_age real, -- example: [0.0, 37.1]\n parents_and_widowed integer, -- example: [0, 155]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Aguadilla', 'Aguada', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['AGUADILLA', 'AGUADA', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(COUNT(bad_alias where city = 'Aguada'), COUNT(bad_alias where city = 'Aguadilla'));\nWhat is the difference in the number of bad alias between Aguada city and Aguadilla city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SAINT CROIX', 'DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Post Office', 'Unique Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Point', 'Type', 'St Croix', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\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(type = 'Post Office' ), COUNT(type)) as percentage where county = 'SAINT CROIX';\nAmong the types of postal points in Saint Croix, what percentage of postal points is the post office?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.type = 'Post Office' THEN T1.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T1.zip_code) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'SAINT CROIX'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.type = 'Post Office' THEN T1.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T1.zip_code) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'SAINT CROIX'",
"index": 2556,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SAINT CROIX', 'DIVIDE', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Post Office', 'Unique Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n retired_workers integer, -- example: [0, 2940]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Point', 'Type', 'St Croix', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\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(type = 'Post Office' ), COUNT(type)) as percentage where county = 'SAINT CROIX';\nAmong the types of postal points in Saint Croix, what percentage of postal points is the post office?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Daylight', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n population_2020 integer, -- example: [0, 11737]\n american_indian_population integer, -- example: [0, 113]\n male_median_age real, -- example: [0.0, 34.5]\n business_mailboxes integer, -- example: [1, 0]\n land_area real, -- example: [0.0, 64.348]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not implement daylight savings refers to daylight_savings = 'No';\nIn cities that do not implement daylight savings, what is the total number of cities?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.area_code) FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.daylight_savings = 'No'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T1.area_code) FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.daylight_savings = 'No'",
"index": 2557,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Daylight', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n daylight_savings text, -- example: ['Yes', 'No']\n longitude real, -- example: [-73.045317, -73.039405]\n population_2020 integer, -- example: [0, 11737]\n american_indian_population integer, -- example: [0, 113]\n male_median_age real, -- example: [0.0, 34.5]\n business_mailboxes integer, -- example: [1, 0]\n land_area real, -- example: [0.0, 64.348]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not implement daylight savings refers to daylight_savings = 'No';\nIn cities that do not implement daylight savings, what is the total number of cities?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n division text, -- example: ['Middle Atlantic', 'New England']\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n hispanic_population integer, -- example: [0, 18486]\n hawaiian_population integer, -- example: [0, 10]\n median_age real, -- example: [0.0, 35.9]\n total_delivery_receptacles integer, -- example: [1, 0]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n retired_workers integer, -- example: [0, 2940]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe largest water area refers to MAX(water_area);\nAmong the listed cities, provide the area code of the city with the largest water area.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.water_area = ( SELECT MAX(water_area) FROM zip_data )",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.water_area = ( SELECT MAX(water_area) FROM zip_data )",
"index": 2558,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n division text, -- example: ['Middle Atlantic', 'New England']\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n hispanic_population integer, -- example: [0, 18486]\n hawaiian_population integer, -- example: [0, 10]\n median_age real, -- example: [0.0, 35.9]\n total_delivery_receptacles integer, -- example: [1, 0]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n retired_workers integer, -- example: [0, 2940]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe largest water area refers to MAX(water_area);\nAmong the listed cities, provide the area code of the city with the largest water area.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest population in year 2020 refers to MAX(population_2020);\nProvide the alias of the city with the highest population in year 2020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2020 = ( SELECT MAX(population_2020) FROM zip_data )",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2020 = ( SELECT MAX(population_2020) FROM zip_data )",
"index": 2559,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest population in year 2020 refers to MAX(population_2020);\nProvide the alias of the city with the highest population in year 2020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Massachusetts', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Massachusetts', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Hampden', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Hampden', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Hampden', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['HAMPDEN', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe county of Hampden is located in the state of Massachusetts.\nWhat is the elevation of the city belonging to Hampden, Massachusetts?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.elevation FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T1.name = 'Massachusetts' AND T2.county = 'HAMPDEN' GROUP BY T3.elevation",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T3.elevation FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T1.name = 'Massachusetts' AND T2.county = 'HAMPDEN' GROUP BY T3.elevation",
"index": 2560,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Massachusetts', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Massachusetts', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Hampden', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Hampden', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Hampden', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['HAMPDEN', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe county of Hampden is located in the state of Massachusetts.\nWhat is the elevation of the city belonging to Hampden, Massachusetts?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest Hispanic population refers to MAX(hispanic_population);\nList the area code of the city with the highest Hispanic population.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.hispanic_population = ( SELECT MAX(hispanic_population) FROM zip_data )",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.hispanic_population = ( SELECT MAX(hispanic_population) FROM zip_data )",
"index": 2561,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest Hispanic population refers to MAX(hispanic_population);\nList the area code of the city with the highest Hispanic population.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsian population of 7 refers to asian_population = 7;\nGive the alias of the cities with an Asian population of 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 T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.asian_population = 7",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.asian_population = 7",
"index": 2562,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n disabled_workers integer, -- disable workers, example: [0, 885]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsian population of 7 refers to asian_population = 7;\nGive the alias of the cities with an Asian population of 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 congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Kirkpatrick', 'Young', 'Begich']\n last_name text, -- example: ['Ann', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['District', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code;\nCount the number of postal points in the district represented by Kirkpatrick Ann.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Kirkpatrick' AND T1.last_name = 'Ann'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Kirkpatrick' AND T1.last_name = 'Ann'",
"index": 2563,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Kirkpatrick', 'Young', 'Begich']\n last_name text, -- example: ['Ann', 'Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['District', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code;\nCount the number of postal points in the district represented by Kirkpatrick Ann.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Garfield', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Garfield', 'Congress', 'Points', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n population_2020 integer, -- example: [0, 11737]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['GARFIELD', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho are the congress representatives refer to first_name, last_name; Garfield is the city;\nWho are the congress representatives of the postal points in Garfield?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.city = 'Garfield'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.city = 'Garfield'",
"index": 2564,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Garfield', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Garfield', 'Congress', 'Points', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n population_2020 integer, -- example: [0, 11737]\n american_indian_population integer, -- example: [0, 113]\n other_population integer, -- example: [0, 558]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['GARFIELD', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho are the congress representatives refer to first_name, last_name; Garfield is the city;\nWho are the congress representatives of the postal points in Garfield?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Puerto Rico', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Puerto Rico', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Congress', 'Points', 'Point', 'Many', 'Rico', 'Holtsville']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Puerto Rico', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n american_indian_population integer, -- example: [0, 113]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; Puerto Rico refers to state = 'Puerto Rico';\nHow many postal points are there under the congress representative in Puerto Rico?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Puerto Rico'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Puerto Rico'",
"index": 2565,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Puerto Rico', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Puerto Rico', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Congress', 'Points', 'Point', 'Many', 'Rico', 'Holtsville']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Puerto Rico', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n elevation integer, -- example: [25, 0]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2010 integer, -- example: [0, 18570]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n american_indian_population integer, -- example: [0, 113]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; Puerto Rico refers to state = 'Puerto Rico';\nHow many postal points are there under the congress representative in Puerto Rico?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Virginia', 'Points', 'Point', 'West', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Virginia', 'Point', 'West', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['West Virginia', 'Virginia', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['West Virginia', 'Virginia', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n county_fips integer, -- country fips, example: [103, 1]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; West Virginia is the name of the state, in which name = 'West Virginia';\nDescribe the number of postal points and the countries in West Virginia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.zip_code), COUNT(DISTINCT T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'West Virginia'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.zip_code), COUNT(DISTINCT T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'West Virginia'",
"index": 2566,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Virginia', 'Points', 'Point', 'West', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Virginia', 'Point', 'West', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['West Virginia', 'Virginia', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['West Virginia', 'Virginia', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n county_fips integer, -- country fips, example: [103, 1]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n businesses integer, -- example: [2, 0]\n annual_payroll integer, -- example: [0, 376492000]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; West Virginia is the name of the state, in which name = 'West Virginia';\nDescribe the number of postal points and the countries in West Virginia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Point', 'Post', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Point', 'Post', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Community Post Office ', 'Post Office', 'Unique Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommunity post office type refers to type = 'Community Post Office'; elevation above 6000 refers to elevation > 6000;\nProvide the zip codes and area codes of the postal points with the community post office type at the elevation above 6000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code, T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.type = 'Community Post Office ' AND T2.elevation > 6000",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.zip_code, T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.type = 'Community Post Office ' AND T2.elevation > 6000",
"index": 2567,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Point', 'Post', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Point', 'Post', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Community Post Office ', 'Post Office', 'Unique Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n division text, -- example: ['Middle Atlantic', 'New England']\n population_2020 integer, -- example: [0, 11737]\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n female_median_age real, -- example: [0.0, 37.1]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n over_65 integer, -- example: [0, 3245]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommunity post office type refers to type = 'Community Post Office'; elevation above 6000 refers to elevation > 6000;\nProvide the zip codes and area codes of the postal points with the community post office type at the elevation above 6000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Mississippi', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['MISSISSIPPI', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'US House Of Representatives', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Congress', 'Points', 'House', 'Point', 'Many', 'Holtsville']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Mississippi', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n total_delivery_receptacles integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n total_beneficiaries integer, -- example: [0, 5135]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; Mississippi is the name of the state, in which name = 'Mississippi';\nHow many postal points are there under the congress representative from the House of Representatives in Mississippi?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Mississippi'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Mississippi'",
"index": 2568,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Mississippi', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['MISSISSIPPI', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'US House Of Representatives', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Congress', 'Points', 'House', 'Point', 'Many', 'Holtsville']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n party text, -- example: ['Republican', 'Democrat']\n state text, -- example: ['Mississippi', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n state text, -- example: ['NY', 'PR']\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2010 integer, -- example: [0, 18570]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n black_population integer, -- example: [0, 663]\n asian_population integer, -- example: [0, 7]\n total_delivery_receptacles integer, -- example: [1, 0]\n annual_payroll integer, -- example: [0, 376492000]\n total_beneficiaries integer, -- example: [0, 5135]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; Mississippi is the name of the state, in which name = 'Mississippi';\nHow many postal points are there under the congress representative from the House of Representatives in Mississippi?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Springfield', 'Point', 'Cid', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['East Springfield', 'Springfield', 'Congress', 'Points', 'Point', 'Holtsville']\n state text, -- example: ['ID', 'NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n male_population integer, -- example: [0, 9078]\n children integer, -- example: [0, 1010]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['ID', 'AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['ID', 'AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['ID', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['East Springfield', 'Springfield', 'Congress', 'Points', 'Point', 'West Springfield']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncongress representatives' IDs refer to CID; East Springfield is the city;\nProvide the congress representatives' IDs of the postal points in East Springfield.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code WHERE T1.city = 'East Springfield'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T2.district FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code WHERE T1.city = 'East Springfield'",
"index": 2569,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Springfield', 'Point', 'Cid', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['East Springfield', 'Springfield', 'Congress', 'Points', 'Point', 'Holtsville']\n state text, -- example: ['ID', 'NY', 'PR']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n daylight_savings text, -- example: ['Yes', 'No']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n male_population integer, -- example: [0, 9078]\n children integer, -- example: [0, 1010]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n CID text, -- example: ['N00008091', 'N00009585']\n abbreviation text, -- example: ['ID', 'AK', 'AL']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['ID', 'AA', 'AE']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['ID', 'NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['East Springfield', 'Springfield', 'Congress', 'Points', 'Point', 'West Springfield']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncongress representatives' IDs refer to CID; East Springfield is the city;\nProvide the congress representatives' IDs of the postal points in East Springfield.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Point', 'Post', 'Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n employees integer, -- example: [0, 9127]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCBSA officer refers to CBSA_name; the highest number of employees refers to MAX(employees);\nWho is the CBSA officer of the post point in the area with the highest number of employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.employees = ( SELECT MAX(employees) FROM zip_data )",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.employees = ( SELECT MAX(employees) FROM zip_data )",
"index": 2570,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Point', 'Post', 'Max', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n type text, -- example: ['Unique Post Office', 'Post Office']\n time_zone text, -- example: ['Eastern', 'Atlantic']\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n households integer, -- example: [0, 6525]\n avg_house_value integer, -- average house value, example: [0, 86200]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n other_population integer, -- example: [0, 558]\n male_population integer, -- example: [0, 9078]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n business_mailboxes integer, -- example: [1, 0]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n employees integer, -- example: [0, 9127]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n last_name text, -- example: ['Don', 'Mark']\n CID text, -- example: ['N00008091', 'N00009585']\n state text, -- example: ['Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n land_area real, -- example: [571951.26, 570641.0]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCBSA officer refers to CBSA_name; the highest number of employees refers to MAX(employees);\nWho is the CBSA officer of the post point in the area with the highest number of employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n state text, -- example: ['Ohio', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['OHIO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Point', 'Many', 'Ohio', 'Post', 'Holtsville']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Point', 'Many', 'Ohio', 'Post', 'Holtsville']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Ohio', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; unique post office types refer to type = 'Unique Post Office'; Ohio is the name of the state, in which name = 'Ohio';\nHow many postal points with unique post office types are there in Ohio?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Ohio' AND T2.type = 'Unique Post Office'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Ohio' AND T2.type = 'Unique Post Office'",
"index": 2571,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n first_name text, -- example: ['Young', 'Begich']\n last_name text, -- example: ['Don', 'Mark']\n state text, -- example: ['Ohio', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n House text, -- example: ['House of Repsentatives', 'Senate']\n District integer, -- example: [1, 2]\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['OHIO', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Points', 'Point', 'Many', 'Ohio', 'Post', 'Holtsville']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n organization text, -- example: ['I R S Service Center', 'Irs Service Center']\n daylight_savings text, -- example: ['Yes', 'No']\n latitude real, -- example: [40.817923, 40.788827]\n longitude real, -- example: [-73.045317, -73.039405]\n state_fips integer, -- example: [36, 72]\n county_fips integer, -- country fips, example: [103, 1]\n region text, -- example: ['Northeast', 'South']\n population_2020 integer, -- example: [0, 11737]\n avg_house_value integer, -- average house value, example: [0, 86200]\n avg_income_per_household integer, -- average income per household, example: [0, 13092]\n persons_per_household real, -- example: [0.0, 2.84]\n white_population integer, -- example: [0, 17479]\n black_population integer, -- example: [0, 663]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n hawaiian_population integer, -- example: [0, 10]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n median_age real, -- example: [0.0, 35.9]\n male_median_age real, -- example: [0.0, 34.5]\n residential_mailboxes integer, -- example: [0, 4133]\n total_delivery_receptacles integer, -- example: [1, 0]\n businesses integer, -- example: [2, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n employees integer, -- example: [0, 9127]\n water_area real, -- example: [0.0, 0.309]\n land_area real, -- example: [0.0, 64.348]\n single_family_delivery_units integer, -- single-family delivery units, example: [0, 2419]\n multi_family_delivery_units integer, -- multi-family delivery units, example: [0, 1264]\n total_beneficiaries integer, -- example: [0, 5135]\n retired_workers integer, -- example: [0, 2940]\n disabled_workers integer, -- disable workers, example: [0, 885]\n parents_and_widowed integer, -- example: [0, 155]\n spouses integer, -- example: [0, 145]\n children integer, -- example: [0, 1010]\n monthly_benefits_all integer, -- example: [0, 6137000]\n monthly_benefits_retired_workers integer, -- example: [0, 4007000]\n monthly_benefits_widowed integer, -- example: [0, 185000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Points', 'Point', 'Many', 'Ohio', 'Post', 'Holtsville']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Ohio', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Point', 'Type', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n CBSA_name text, -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR']\n CBSA_type text, -- example: ['Micro', 'Metro']\n PRIMARY KEY (CBSA)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal points refer to zip_code; unique post office types refer to type = 'Unique Post Office'; Ohio is the name of the state, in which name = 'Ohio';\nHow many postal points with unique post office types are there in Ohio?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Guam', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n division text, -- example: ['Middle Atlantic', 'New England']\n households integer, -- example: [0, 6525]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n female_median_age real, -- example: [0.0, 37.1]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n total_beneficiaries integer, -- example: [0, 5135]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Guam', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'GUAM', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\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(total_beneficiaries), COUNT(zip_code)) where name = 'Guam';\nCalculate the average number of beneficiaries per postal point in Guam.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(T2.total_beneficiaries) AS REAL) / COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Guam'",
"style": "rule"
} | {
"db_id": "address.sqlite",
"gt_sql": "SELECT CAST(SUM(T2.total_beneficiaries) AS REAL) / COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Guam'",
"index": 2572,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CBSA (\n CBSA integer, -- example: [10300, 10380]\n PRIMARY KEY (CBSA)\n);\n\nCREATE TABLE congress (\n cognress_rep_id text, -- congress representative id, example: ['AK', 'AK-S1']\n state text, -- example: ['Guam', 'Alaska', 'Alabama']\n abbreviation text, -- example: ['AK', 'AL']\n PRIMARY KEY (cognress_rep_id),\n CONSTRAINT fk_congress_abbreviation FOREIGN KEY (abbreviation) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE zip_data (\n zip_code integer, -- example: [501, 544]\n city text, -- example: ['Divide', 'Point', 'Holtsville', 'Adjuntas']\n state text, -- example: ['NY', 'PR']\n multi_county text, -- multi country, example: ['No', 'Yes']\n type text, -- example: ['Unique Post Office', 'Post Office']\n elevation integer, -- example: [25, 0]\n state_fips integer, -- example: [36, 72]\n division text, -- example: ['Middle Atlantic', 'New England']\n households integer, -- example: [0, 6525]\n hispanic_population integer, -- example: [0, 18486]\n asian_population integer, -- example: [0, 7]\n american_indian_population integer, -- example: [0, 113]\n male_population integer, -- example: [0, 9078]\n female_population integer, -- example: [0, 9492]\n female_median_age real, -- example: [0.0, 37.1]\n total_delivery_receptacles integer, -- example: [1, 0]\n 1st_quarter_payroll integer, -- example: [0, 88685000]\n annual_payroll integer, -- example: [0, 376492000]\n water_area real, -- example: [0.0, 0.309]\n total_beneficiaries integer, -- example: [0, 5135]\n spouses integer, -- example: [0, 145]\n monthly_benefits_all integer, -- example: [0, 6137000]\n CBSA integer, -- example: [35620, 38660]\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_zip_data_state FOREIGN KEY (state) REFERENCES state (abbreviation),\n CONSTRAINT fk_zip_data_cbsa FOREIGN KEY (CBSA) REFERENCES CBSA (CBSA)\n);\n\nCREATE TABLE state (\n abbreviation text, -- example: ['AA', 'AE']\n name text, -- example: ['Guam', 'Armed Forces Americas', 'Armed Forces Europe']\n PRIMARY KEY (abbreviation)\n);\n\nCREATE TABLE zip_congress (\n zip_code integer, -- example: [501, 601]\n district text, -- example: ['NY-1', 'PR']\n PRIMARY KEY (zip_code, district),\n CONSTRAINT fk_zip_congress_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_zip_congress_district FOREIGN KEY (district) REFERENCES congress (cognress_rep_id)\n);\n\nCREATE TABLE alias (\n zip_code integer, -- example: [501, 544]\n alias text, -- example: ['Divide', 'Point', 'Holtsville', 'Adjuntas']\n PRIMARY KEY (zip_code),\n CONSTRAINT fk_alias_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE avoid (\n zip_code integer, -- example: [501, 544]\n bad_alias text, -- example: ['Divide', 'Point', 'Internal Revenue Service', 'Colinas Del Gigante']\n PRIMARY KEY (zip_code, bad_alias),\n CONSTRAINT fk_avoid_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\n);\n\nCREATE TABLE country (\n zip_code integer, -- example: [501, 544]\n county text, -- country, example: ['DIVIDE', 'GUAM', 'SUFFOLK', 'ADJUNTAS']\n state text, -- example: ['NY', 'PR']\n PRIMARY KEY (zip_code, county),\n CONSTRAINT fk_country_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code),\n CONSTRAINT fk_country_state FOREIGN KEY (state) REFERENCES state (abbreviation)\n);\n\nCREATE TABLE area_code (\n zip_code integer, -- example: [501, 544]\n area_code integer, -- example: [631, 787]\n PRIMARY KEY (zip_code, area_code),\n CONSTRAINT fk_area_code_zip_code FOREIGN KEY (zip_code) REFERENCES zip_data (zip_code)\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(total_beneficiaries), COUNT(zip_code)) where name = 'Guam';\nCalculate the average number of beneficiaries per postal point in Guam.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNorth America refers to country = 'United States'; North America is the name of continent where country = 'United States' is located;\nHow many breweries are located in North America?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(BrandID) FROM rootbeerbrand WHERE Country = 'United States'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(BrandID) FROM rootbeerbrand WHERE Country = 'United States'",
"index": 2573,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNorth America refers to country = 'United States'; North America is the name of continent where country = 'United States' is located;\nHow many breweries are located in North America?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the root beer brand refers to BrandName; advertised on facebook refers to FacebookPage IS not NULL;\nPlease list the names of all the root beer brands that are advertised on 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 BrandName FROM rootbeerbrand WHERE FacebookPage IS NOT NULL",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT BrandName FROM rootbeerbrand WHERE FacebookPage IS NOT NULL",
"index": 2574,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the root beer brand refers to BrandName; advertised on facebook refers to FacebookPage IS not NULL;\nPlease list the names of all the root beer brands that are advertised on 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 location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07';\nHow many transactions had Frank-Paul Santangelo made in July, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND STRFTIME('%Y-%m', T2.TransactionDate) = '2014-07'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND STRFTIME('%Y-%m', T2.TransactionDate) = '2014-07'",
"index": 2575,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07';\nHow many transactions had Frank-Paul Santangelo made in July, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2014-07-07', '2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-07-07', '2014-07-01', '2014-07-03', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrands of the root beer refers to BrandName; purchased on 2014/7/7 refers to transactiondate = '2014-07-07';\nPlease list the brands of all the root beer that Frank-Paul Santangelo had purchased on 2014/7/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 DISTINCT T4.BrandName FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T4.BrandName FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07'",
"index": 2576,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2014-07-07', '2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-07-07', '2014-07-01', '2014-07-03', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrands of the root beer refers to BrandName; purchased on 2014/7/7 refers to transactiondate = '2014-07-07';\nPlease list the brands of all the root beer that Frank-Paul Santangelo had purchased on 2014/7/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 rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Can', 'Bottle']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-07-07', '2014-07-01', '2014-07-03', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 2014/7/7 refers to transactiondate = '2014-07-07'; in cans refers to containertype = 'Can';\nOf the 4 root beers that Frank-Paul Santangelo purchased on 2014/7/7, how many of them were in cans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07' AND T3.ContainerType = 'Can'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07' AND T3.ContainerType = 'Can'",
"index": 2577,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Can', 'Bottle']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-07-07', '2014-07-01', '2014-07-03', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n ZipCode integer, -- example: [94256, 94258]\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 2014/7/7 refers to transactiondate = '2014-07-07'; in cans refers to containertype = 'Can';\nOf the 4 root beers that Frank-Paul Santangelo purchased on 2014/7/7, how many of them were in cans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['Bulldog', 'A&W', 'A.J. Stephans']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBulldog refers to BrandName = 'Bulldog'; purchased in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';\nHow many root beers of the Bulldog were purchased in August, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.BrandName = 'Bulldog'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.BrandName = 'Bulldog'",
"index": 2578,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['Bulldog', 'A&W', 'A.J. Stephans']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBulldog refers to BrandName = 'Bulldog'; purchased in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';\nHow many root beers of the Bulldog were purchased in August, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['AJ Stephans Beverages', 'Dr Pepper Snapple Group']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = First, Last; customers who have purchased at least one root beer refers to CustomerID > = 1; produced by AJ Stephans Beverages refers to BreweryName = 'AJ Stephans Beverages';\nPlease list the full names of the customers who have purchased at least one root beer produced by AJ Stephans Beverages.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.Last FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T4.BreweryName = 'AJ Stephans Beverages'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T4.BreweryName = 'AJ Stephans Beverages'",
"index": 2579,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['AJ Stephans Beverages', 'Dr Pepper Snapple Group']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = First, Last; customers who have purchased at least one root beer refers to CustomerID > = 1; produced by AJ Stephans Beverages refers to BreweryName = 'AJ Stephans Beverages';\nPlease list the full names of the customers who have purchased at least one root beer produced by AJ Stephans Beverages.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not advertise on Twitter refers to twitter IS NULL; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';\nAmong the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.Twitter IS NULL",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.Twitter IS NULL",
"index": 2580,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not advertise on Twitter refers to twitter IS NULL; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';\nAmong the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-07-07', '2014-07-01', '2014-07-03', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of the credit card refers to CreditCardNumber; on 2014/7/7 refers to TransactionDate = '2014-07-07';\nWhat is the number of the credit card that Frank-Paul Santangelo used to purchase root beers on 2014/7/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 DISTINCT T2.CreditCardNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT DISTINCT T2.CreditCardNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07'",
"index": 2581,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-07-07', '2014-07-01', '2014-07-03', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of the credit card refers to CreditCardNumber; on 2014/7/7 refers to TransactionDate = '2014-07-07';\nWhat is the number of the credit card that Frank-Paul Santangelo used to purchase root beers on 2014/7/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 rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon-sweetened refers to honey = 'FALSE' AND artificialsweetener = 'FALSE';\nAmong all the root beers purchased by Frank-Paul Santangelo, how many of them were non-sweetened?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T4.ArtificialSweetener = 'FALSE' AND T4.Honey = 'FALSE'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T4.ArtificialSweetener = 'FALSE' AND T4.Honey = 'FALSE'",
"index": 2582,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Frank-Paul', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Santangelo', 'Walton', 'Jones']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon-sweetened refers to honey = 'FALSE' AND artificialsweetener = 'FALSE';\nAmong all the root beers purchased by Frank-Paul Santangelo, how many of them were non-sweetened?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndates of purchase refers to TransactionDate; male customer refers to Gender = 'M'; purchased more than 3 root beers refers to COUNT(CustomerID) > 3;\nPlease list the dates on which a male customer has purchased more than 3 root beers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TransactionDate FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Gender = 'M' GROUP BY T2.TransactionDate HAVING COUNT(T2.CustomerID) > 3",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.TransactionDate FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Gender = 'M' GROUP BY T2.TransactionDate HAVING COUNT(T2.CustomerID) > 3",
"index": 2583,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndates of purchase refers to TransactionDate; male customer refers to Gender = 'M'; purchased more than 3 root beers refers to COUNT(CustomerID) > 3;\nPlease list the dates on which a male customer has purchased more than 3 root beers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['James', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['House', 'James', 'Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nTell the number of reviews given by James House.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'James' AND T1.Last = 'House'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T2.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'James' AND T1.Last = 'House'",
"index": 2584,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['James', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['House', 'James', 'Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nTell the number of reviews given by James House.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinate = Latitude, Longitude; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';\nState the coordinate of Sac State American River Courtyard.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.LocationName = 'Sac State American River Courtyard'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.LocationName = 'Sac State American River Courtyard'",
"index": 2585,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['Sac State American River Courtyard', 'LOST']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinate = Latitude, Longitude; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';\nState the coordinate of Sac State American River Courtyard.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the location refers to LocationName; transaction no. refers to TransactionID; TransactionID = 100885;\nProvide the name of the location where transaction no.100885 happened.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.LocationName FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TransactionID = 100885",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.LocationName FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TransactionID = 100885",
"index": 2586,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n State text, -- example: ['CA', 'MA']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the location refers to LocationName; transaction no. refers to TransactionID; TransactionID = 100885;\nProvide the name of the location where transaction no.100885 happened.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer that has the most reviews refers to MAX(COUNT(CustomerID)); full name = First, Last;\nWhich customer has the most reviews? State the full 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.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY COUNT(T2.CustomerID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY COUNT(T2.CustomerID) DESC LIMIT 1",
"index": 2587,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer that has the most reviews refers to MAX(COUNT(CustomerID)); full name = First, Last;\nWhich customer has the most reviews? State the full 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 rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Price', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreview with the content of \"The quintessential dessert root beer. No ice cream required.\" refers to Review = 'The quintessential dessert root beer. No ice cream required.';\nFor the root beer brand which got the review with the content of \"The quintessential dessert root beer. No ice cream required.\", what is the current retail price of the root beer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CurrentRetailPrice - T1.WholesaleCost AS price FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.Review = 'The quintessential dessert root beer. No ice cream required.'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T1.CurrentRetailPrice - T1.WholesaleCost AS price FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.Review = 'The quintessential dessert root beer. No ice cream required.'",
"index": 2588,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Price', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreview with the content of \"The quintessential dessert root beer. No ice cream required.\" refers to Review = 'The quintessential dessert root beer. No ice cream required.';\nFor the root beer brand which got the review with the content of \"The quintessential dessert root beer. No ice cream required.\", what is the current retail price of the root beer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['River City', 'A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\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(BrandID WHERE StarRating = 5), COUNT(BrandID) WHERE BrandName = 'River City'), 1.0); 5 star ratings refers to StarRating = 5; River City refers to BrandName = 'River City';\nWhat is the percentage of 5 star ratings River City brand root beer get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.StarRating = 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.StarRating) FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BrandName = 'River City'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.StarRating = 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.StarRating) FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BrandName = 'River City'",
"index": 2589,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['River City', 'A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\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(BrandID WHERE StarRating = 5), COUNT(BrandID) WHERE BrandName = 'River City'), 1.0); 5 star ratings refers to StarRating = 5; River City refers to BrandName = 'River City';\nWhat is the percentage of 5 star ratings River City brand root beer get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['F', 'M']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\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 = 'F'; customer permits the company to send regular emails to them refers to SubscribedToEmailList = 'TRUE';\nHow many female customers permit the company to send regular emails to them?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(CustomerID) FROM customers WHERE Gender = 'F' AND SubscribedToEmailList = 'TRUE'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(CustomerID) FROM customers WHERE Gender = 'F' AND SubscribedToEmailList = 'TRUE'",
"index": 2590,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n SubscribedToEmailList text, -- example: ['TRUE', 'FALSE']\n Gender text, -- example: ['F', 'M']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n City text, -- example: ['Lodi', 'Fall River']\n Country text, -- example: ['United States', 'Australia']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\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 = 'F'; customer permits the company to send regular emails to them refers to SubscribedToEmailList = 'TRUE';\nHow many female customers permit the company to send regular emails to them?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the brand of the beer refers to BrandName; shortest brewed history refers to MAX(FirstBrewedYear);\nWhat is the name of the brand of the beer with the shortest brewed history?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT BrandName FROM rootbeerbrand ORDER BY FirstBrewedYear DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT BrandName FROM rootbeerbrand ORDER BY FirstBrewedYear DESC LIMIT 1",
"index": 2591,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the brand of the beer refers to BrandName; shortest brewed history refers to MAX(FirstBrewedYear);\nWhat is the name of the brand of the beer with the shortest brewed history?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2016-01-01', '2016-01-06', '2016-01-09', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2016-01-01', '2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost purchased root beer refers to MAX(COUNT(BrandID)); in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31';\nWhich brewery does the most purchased root beer in 2016 belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.PurchaseDate BETWEEN '2016-01-01' AND '2016-12-31' GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.PurchaseDate BETWEEN '2016-01-01' AND '2016-12-31' GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"index": 2592,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2016-01-01', '2016-01-06', '2016-01-09', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2016-01-01', '2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost purchased root beer refers to MAX(COUNT(BrandID)); in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31';\nWhich brewery does the most purchased root beer in 2016 belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-01-01', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2015-01-01', '2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Tom', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Hanks', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 2015 to 2016 refers to TransactionDate > = '2015-01-01' AND TransactionDate < '2016-12-31';\nHow many root beers did Tom Hanks purchase between 2015 to 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.RootBeerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Tom' AND T1.Last = 'Hanks' AND T2.TransactionDate BETWEEN '2015-01-01' AND '2016-12-31'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T2.RootBeerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Tom' AND T1.Last = 'Hanks' AND T2.TransactionDate BETWEEN '2015-01-01' AND '2016-12-31'",
"index": 2593,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-01-01', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2015-01-01', '2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Tom', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Hanks', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 2015 to 2016 refers to TransactionDate > = '2015-01-01' AND TransactionDate < '2016-12-31';\nHow many root beers did Tom Hanks purchase between 2015 to 2016?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: [\"Henry Weinhard's\", 'A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Nicholas', 'Henry', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Sparks', 'Henry', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHenry Weinhard's refers to BrandName = 'Henry Weinhard''s';\nHow many Henry Weinhard's were bought by Nicholas Sparks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Nicholas' AND T1.Last = 'Sparks' AND T4.BrandName LIKE 'Henry Weinhard%s'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Nicholas' AND T1.Last = 'Sparks' AND T4.BrandName LIKE 'Henry Weinhard%s'",
"index": 2594,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: [\"Henry Weinhard's\", 'A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Nicholas', 'Henry', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Sparks', 'Henry', 'Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHenry Weinhard's refers to BrandName = 'Henry Weinhard''s';\nHow many Henry Weinhard's were bought by Nicholas Sparks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not advertise on Facebook and Twitter refers to FacebookPage IS NULL AND Twitter IS NULL; highest number of purchases refers to MAX(COUNT(BrandID));\nAmong the root beer brands that do not advertise on Facebook and Twitter, which brand has the highest number of purchases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FacebookPage IS NULL AND T2.Twitter IS NULL GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FacebookPage IS NULL AND T2.Twitter IS NULL GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1",
"index": 2595,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Discover', 'Visa']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n City text, -- example: ['Sacramento', 'Orangevale']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not advertise on Facebook and Twitter refers to FacebookPage IS NULL AND Twitter IS NULL; highest number of purchases refers to MAX(COUNT(BrandID));\nAmong the root beer brands that do not advertise on Facebook and Twitter, which brand has the highest number of purchases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n Honey text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n ZipCode integer, -- example: [94256, 94258]\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrand of root beer refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost)); ID of the customer refers to CustomerID; highest number of purchases refers to MAX(COUNT(CustomerID));\nWhich brand of root beer has the lowest unit profit available to wholesalers? Indicate the ID of the customer that has the highest number of purchases of the said brand.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.BrandName, T2.CustomerID FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost, COUNT(T1.BrandID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT T3.BrandName, T2.CustomerID FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost, COUNT(T1.BrandID) DESC LIMIT 1",
"index": 2596,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n Honey text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Max', 'Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n ZipCode integer, -- example: [94256, 94258]\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n City text, -- example: ['Sacramento']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbrand of root beer refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost)); ID of the customer refers to CustomerID; highest number of purchases refers to MAX(COUNT(CustomerID));\nWhich brand of root beer has the lowest unit profit available to wholesalers? Indicate the ID of the customer that has the highest number of purchases of the said brand.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2014-01-01', '2014-01-04', '2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Can', 'Bottle']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-12-31', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-12-31', '2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2014 refers to PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'; percentage = MULTIPLY(DIVIDE(SUM(ContainerType = 'Can'), COUNT(RootBeerID) WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'), 1.0); in cans refers to ContainerType = 'Can';\nAmong the root beer purchased in 2014, what percentage were sold in cans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ContainerType = 'Can' THEN RootBeerID ELSE NULL END) AS REAL) * 100 / COUNT(RootBeerID) FROM rootbeer WHERE PurchaseDate LIKE '2014%'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN ContainerType = 'Can' THEN RootBeerID ELSE NULL END) AS REAL) * 100 / COUNT(RootBeerID) FROM rootbeer WHERE PurchaseDate LIKE '2014%'",
"index": 2597,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n State text, -- example: ['CA']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n FirstBrewedYear integer, -- example: [1919, 1926]\n State text, -- example: ['CA', 'MA']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n WholesaleCost real, -- example: [0.42, 0.98]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2014-01-01', '2014-01-04', '2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Can', 'Bottle']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2014-12-31', '2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-12-31', '2014-07-07', '2014-07-13']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2014 refers to PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'; percentage = MULTIPLY(DIVIDE(SUM(ContainerType = 'Can'), COUNT(RootBeerID) WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'), 1.0); in cans refers to ContainerType = 'Can';\nAmong the root beer purchased in 2014, what percentage were sold in cans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Visa', 'Discover']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvisa card refers to CreditCardType = 'Visa'; percentage = MULTIPLY(DIVIDE(SUM(CreditCardType = 'Visa'), COUNT(TransactionID)), 1.0);\nAmong the transactions, what percentage is done by using a visa card?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 CreditCardType = 'Visa' THEN TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(TransactionID) FROM `transaction`",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN CreditCardType = 'Visa' THEN TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(TransactionID) FROM `transaction`",
"index": 2598,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n FirstBrewedYear integer, -- example: [1919, 1926]\n BreweryName text, -- example: ['Dr Pepper Snapple Group', 'AJ Stephans Beverages']\n City text, -- example: ['Lodi', 'Fall River']\n State text, -- example: ['CA', 'MA']\n Country text, -- example: ['United States', 'Australia']\n Description text, -- example: ['After setting up the first A&W Root Beer', 'AJ Stephans Company makes \\nthe finest el']\n CaneSugar text, -- example: ['FALSE', 'TRUE']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n Honey text, -- example: ['FALSE', 'TRUE']\n ArtificialSweetener text, -- example: ['FALSE', 'TRUE']\n Caffeinated text, -- example: ['FALSE', 'TRUE']\n Alcoholic text, -- example: ['FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n AvailableInBottles text, -- example: ['FALSE', 'TRUE']\n AvailableInKegs text, -- example: ['FALSE', 'TRUE']\n Website text, -- example: ['http://www.rootbeer.com/', 'http://www.ajstephans.com/']\n FacebookPage text, -- example: ['https://www.facebook.com/Dads-Old-Fashio', 'https://www.facebook.com/Dog-N-Suds-Bott']\n Twitter text, -- example: ['https://twitter.com/ilovedads', 'https://twitter.com/1919rootbeer']\n WholesaleCost real, -- example: [0.42, 0.98]\n CurrentRetailPrice real, -- example: [1.0, 3.0]\n PRIMARY KEY (BrandID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n StarRating integer, -- example: [5, 1]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n Review text, -- example: ['You could have done better Sactown.', 'Too much bite, not enough barq.']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n StreetAddress text, -- example: ['6000 J St']\n City text, -- example: ['Sacramento']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [95819]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Latitude real, -- example: [0.0, 38.566129]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n TransactionDate date, -- example: ['2014-07-07', '2014-07-13']\n CreditCardType text, -- example: ['Visa', 'Discover']\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PurchasePrice real, -- example: [3.0, 1.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Bottle', 'Can']\n LocationID integer, -- example: [1, 2]\n PurchaseDate date, -- example: ['2015-07-03', '2016-05-09']\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n First text, -- first name, example: ['Kenneth', 'Madeleine']\n Last text, -- last name, example: ['Walton', 'Jones']\n StreetAddress text, -- example: ['6715 Commonwealth Dr', '3603 Leola Way']\n City text, -- example: ['Sacramento', 'Orangevale']\n State text, -- example: ['CA']\n ZipCode integer, -- example: [94256, 94258]\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PhoneNumber text, -- example: ['(916) 918-1561', '(916) 186-9423']\n FirstPurchaseDate date, -- example: ['2013-05-30', '2013-02-06']\n SubscribedToEmailList text, -- example: ['FALSE', 'TRUE']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (CustomerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvisa card refers to CreditCardType = 'Visa'; percentage = MULTIPLY(DIVIDE(SUM(CreditCardType = 'Visa'), COUNT(TransactionID)), 1.0);\nAmong the transactions, what percentage is done by using a visa card?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Can', 'Bottle']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n State text, -- example: ['CA', 'MA']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['TRUE', 'FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\navailable in cans refers to AvailableInCans = 'TRUE'; contain corn syrup refers to CornSyrup = 'TRUE'; contain artificial sweeteners refers to ArtificialSweetener = 'TRUE';\nHow many brands of root beers are available in cans and contain corn syrup and artificial sweeteners?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(BrandID) FROM rootbeerbrand WHERE CornSyrup = 'TRUE' AND ArtificialSweetener = 'TRUE' AND AvailableInCans = 'TRUE'",
"style": "rule"
} | {
"db_id": "beer_factory.sqlite",
"gt_sql": "SELECT COUNT(BrandID) FROM rootbeerbrand WHERE CornSyrup = 'TRUE' AND ArtificialSweetener = 'TRUE' AND AvailableInCans = 'TRUE'",
"index": 2599,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customers (\n CustomerID integer, -- example: [101811, 103508]\n Last text, -- last name, example: ['Walton', 'Jones']\n Email text, -- example: ['walton.k76@fastmail.com', 'j_madeleine@gmail.com']\n PRIMARY KEY (CustomerID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [0, 1]\n LocationName text, -- example: ['LOST', 'Sac State American River Courtyard']\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_location_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE geolocation (\n LocationID integer, -- example: [0, 1]\n Longitude real, -- example: [0.0, -121.426432]\n PRIMARY KEY (LocationID),\n CONSTRAINT fk_geolocation_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID)\n);\n\nCREATE TABLE rootbeerreview (\n CustomerID integer, -- example: [101811, 105549]\n BrandID integer, -- example: [10012, 10014]\n ReviewDate date, -- example: ['2013-07-15', '2013-07-08']\n PRIMARY KEY (CustomerID, BrandID),\n CONSTRAINT fk_rootbeerreview_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_rootbeerreview_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID)\n);\n\nCREATE TABLE transaction (\n TransactionID integer, -- example: [100000, 100001]\n CreditCardNumber integer, -- example: [6011583832864739, 4716634257568793]\n CustomerID integer, -- example: [864896, 610766]\n LocationID integer, -- example: [2, 1]\n RootBeerID integer, -- example: [105661, 105798]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transaction_customerid FOREIGN KEY (CustomerID) REFERENCES customers (CustomerID),\n CONSTRAINT fk_transaction_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_transaction_rootbeerid FOREIGN KEY (RootBeerID) REFERENCES rootbeer (RootBeerID)\n);\n\nCREATE TABLE rootbeer (\n RootBeerID integer, -- example: [100000, 100001]\n BrandID integer, -- example: [10001, 10002]\n ContainerType text, -- example: ['Can', 'Bottle']\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (RootBeerID),\n CONSTRAINT fk_rootbeer_brandid FOREIGN KEY (BrandID) REFERENCES rootbeerbrand (BrandID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_rootbeer_locationid FOREIGN KEY (LocationID) REFERENCES geolocation (LocationID)\n);\n\nCREATE TABLE rootbeerbrand (\n BrandID integer, -- example: [10001, 10002]\n BrandName text, -- example: ['A&W', 'A.J. Stephans']\n State text, -- example: ['CA', 'MA']\n CornSyrup text, -- example: ['TRUE', 'FALSE']\n ArtificialSweetener text, -- example: ['TRUE', 'FALSE']\n AvailableInCans text, -- example: ['TRUE', 'FALSE']\n PRIMARY KEY (BrandID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\navailable in cans refers to AvailableInCans = 'TRUE'; contain corn syrup refers to CornSyrup = 'TRUE'; contain artificial sweeteners refers to ArtificialSweetener = 'TRUE';\nHow many brands of root beers are available in cans and contain corn syrup and artificial sweeteners?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.